Skip to content

Commit 41f61e3

Browse files
committed
Radically improve error handling and coverage
1 parent eaf6a30 commit 41f61e3

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

‎c89stringutils/c89stringutils_safecrt.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ __attribute__((noreturn))
2222
#elif defined(_MSC_VER)
2323
__declspec(noreturn)
2424
#endif
25-
extern void mock_abort(void);
25+
extern void
26+
mock_abort(void);
2627
extern FILE *mock_fopen(const char *filename, const char *mode);
2728
extern FILE *mock_freopen(const char *filename, const char *mode, FILE *stream);
2829
extern FILE *mock_tmpfile(void);

‎c89stringutils/c89stringutils_string_extras.h‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,9 @@ typedef size_t rsize_t;
358358
#if defined(C89STRINGUTILS_HAVE_STRERROR_S)
359359
#define c89stringutils_strerror_s strerror_s
360360
#else
361-
extern C89STRINGUTILS_EXPORT
362-
errno_t c89stringutils_strerror_s(char *s, rsize_t maxsize, errno_t errnum);
361+
extern C89STRINGUTILS_EXPORT errno_t c89stringutils_strerror_s(char *s,
362+
rsize_t maxsize,
363+
errno_t errnum);
363364
#endif
364365

365366
/**
@@ -495,13 +496,13 @@ c89stringutils_vsnprintf(char *s, size_t n, const char *format, va_list arg)
495496
#define c89stringutils_strncasecmp(s1, s2, n) \
496497
((((const void *)(s1)) == NULL && ((const void *)(s2)) == NULL) ? 0 \
497498
: (((const void *)(s1)) == NULL) ? -1 \
498-
: (((const void *)(s2)) == NULL) ? 1 \
499+
: (((const void *)(s2)) == NULL) ? 1 \
499500
: _strnicmp((s1), (s2), (n)))
500501
#elif defined(C89STRINGUTILS_HAVE_STRNCASECMP)
501502
#define c89stringutils_strncasecmp(s1, s2, n) \
502503
((((const void *)(s1)) == NULL && ((const void *)(s2)) == NULL) ? 0 \
503504
: (((const void *)(s1)) == NULL) ? -1 \
504-
: (((const void *)(s2)) == NULL) ? 1 \
505+
: (((const void *)(s2)) == NULL) ? 1 \
505506
: strncasecmp((s1), (s2), (n)))
506507
#else
507508
extern C89STRINGUTILS_EXPORT int
@@ -519,13 +520,13 @@ c89stringutils_strncasecmp(const char *s1, const char *s2, size_t n);
519520
#define c89stringutils_strcasecmp(s1, s2) \
520521
((((const void *)(s1)) == NULL && ((const void *)(s2)) == NULL) ? 0 \
521522
: (((const void *)(s1)) == NULL) ? -1 \
522-
: (((const void *)(s2)) == NULL) ? 1 \
523+
: (((const void *)(s2)) == NULL) ? 1 \
523524
: _stricmp((s1), (s2)))
524525
#elif defined(C89STRINGUTILS_HAVE_STRCASECMP)
525526
#define c89stringutils_strcasecmp(s1, s2) \
526527
((((const void *)(s1)) == NULL && ((const void *)(s2)) == NULL) ? 0 \
527528
: (((const void *)(s1)) == NULL) ? -1 \
528-
: (((const void *)(s2)) == NULL) ? 1 \
529+
: (((const void *)(s2)) == NULL) ? 1 \
529530
: strcasecmp((s1), (s2)))
530531
#else
531532
extern C89STRINGUTILS_EXPORT int c89stringutils_strcasecmp(const char *s1,

0 commit comments

Comments
 (0)