2 Commits

Author SHA1 Message Date
8a724cfc87 fix assert 2025-11-21 23:49:33 -08:00
c03d184a05 updating cmakelists 2025-11-21 23:43:24 -08:00
2 changed files with 6 additions and 2 deletions

View File

@@ -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
View File

@@ -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) {