Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8a724cfc87 | |||
| c03d184a05 |
@@ -4,11 +4,15 @@ project(ke C) # Specify C language explicitly
|
|||||||
set(CMAKE_C_STANDARD 99)
|
set(CMAKE_C_STANDARD 99)
|
||||||
set(KE_VERSION "1.0.0")
|
set(KE_VERSION "1.0.0")
|
||||||
|
|
||||||
|
set(CMAKE_C_FLAGS "-Wall -Wextra -pedantic -Wshadow -Werror -std=c99 -g")
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_DEFAULT_SOURCE -D_XOPEN_SOURCE")
|
||||||
|
|
||||||
|
|
||||||
# Add executable
|
# Add executable
|
||||||
add_executable(ke main.c)
|
add_executable(ke main.c)
|
||||||
|
|
||||||
# Define KE_VERSION for use in C code (e.g., #define KE_VERSION)
|
# Define KE_VERSION for use in C code (e.g., #define KE_VERSION)
|
||||||
target_compile_definitions(ke PRIVATE KE_VERSION="${KE_VERSION}")
|
target_compile_definitions(ke PRIVATE KE_VERSION="ke version ${KE_VERSION}")
|
||||||
|
|
||||||
# Set output properties
|
# Set output properties
|
||||||
set_target_properties(ke PROPERTIES
|
set_target_properties(ke PROPERTIES
|
||||||
|
|||||||
2
main.c
2
main.c
@@ -229,7 +229,7 @@ ab_append(struct abuf *buf, const char *s, int len)
|
|||||||
char *nc = buf->b;
|
char *nc = buf->b;
|
||||||
int sz;
|
int sz;
|
||||||
|
|
||||||
assert((delta <= 0 && buf->len < INT_MAX - delta));
|
assert((delta >= 0 && buf->len < INT_MAX - delta));
|
||||||
sz = buf->len + delta;
|
sz = buf->len + delta;
|
||||||
|
|
||||||
if (sz >= buf->cap) {
|
if (sz >= buf->cap) {
|
||||||
|
|||||||
Reference in New Issue
Block a user