Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
freebsd_instance:
image_family: freebsd-13-0
image_family: freebsd-14

task:
install_script: pkg install -y cmake
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
EOF

- name: Compile Test Amalgamation
run: gcc -Wall -Wextra -Werror -o test_amalg test_amalg.c
run: gcc -std=c89 -Wpedantic -Wall -Wextra -Werror -o test_amalg test_amalg.c

- name: Run Test Amalgamation
run: ./test_amalg
10 changes: 7 additions & 3 deletions c89stringutils/c89stringutils_string_extras.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,11 @@ char *strnstr(const char *buffer, const char *target, size_t bufferLength) {
character of the first occurrence of little is returned.

[this doc (c) FreeBSD <3 clause BSD license> from their manpage] */
const size_t targetLength = strlen(target);
size_t targetLength;
const char *start;

/* Fix assignment of targetLength. C89 requires variables to be defined at beginning of a scope */
targetLength = strlen(target);
if (targetLength == 0)
return (char *)buffer;
for (start = buffer; *start && start + targetLength <= buffer + bufferLength;
Expand All @@ -125,7 +128,8 @@ char *strnstr(const char *buffer, const char *target, size_t bufferLength) {
/* `strcasestr` from MUSL */

char *strcasestr(const char *h, const char *n) {
const size_t l = strlen(n);
size_t l;
l = strlen(n);
for (; *h; h++)
if (!strncasecmp(h, n, l))
return (char *)h;
Expand Down Expand Up @@ -192,7 +196,7 @@ size_t strerrorlen_s(errno_t errnum) {
#ifdef HAVE___VA_COPY
#define VA_COPY(dest, src) __va_copy(dest, src)
#else
#define VA_COPY(dest, src) (dest) = (src)
#define VA_COPY(dest, src) memcpy(&(dest), &(src), sizeof(va_list))
#endif
#endif
#endif /* ! VA_COPY */
Expand Down
3 changes: 2 additions & 1 deletion c89stringutils/c89stringutils_string_extras.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ extern "C" {
#if defined(_MSC_VER)
#define NUM_FORMAT "%I64d"
#else
#define NUM_FORMAT "%lld"
/* Fix:- Change from C99 long long to long */
#define NUM_FORMAT "%ld"
#endif

#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
Expand Down