diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2021-08-06 17:52:20 -0700 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2021-08-06 17:52:20 -0700 |
| commit | ac2e8f5a15a968f236387ed98e34b4a9250c9a92 (patch) | |
| tree | b4502a440038dd8e31641d9c403e0920a08e3b3b /utils.c | |
| parent | 7456a21ddbe25f8e2d6f05f670a3b540028ddf60 (diff) | |
Improved, cleaner/faster/more flexible return value checks
Diffstat (limited to 'utils.c')
| -rw-r--r-- | utils.c | 30 |
1 files changed, 0 insertions, 30 deletions
@@ -129,36 +129,6 @@ char unescapechar(const char *escaped, const char **end) } // -// If the given argument is NULL, print the error message and exit with -// failure. Otherwise return the given argument. -// -void *check_nonnull(void *p, const char *err_msg, ...) -{ - if (p == NULL) { - va_list args; - va_start(args, err_msg); - verr(EXIT_FAILURE, err_msg, args); - va_end(args); - } - return p; -} - -// -// If the given argument is negative, print the error message and exit with -// failure. Otherwise return the given argument. -// -int check_nonnegative(int i, const char *err_msg, ...) -{ - if (i < 0) { - va_list args; - va_start(args, err_msg); - verr(EXIT_FAILURE, err_msg, args); - va_end(args); - } - return i; -} - -// // Case-insensitive memory comparison // int memicmp(const void *v1, const void *v2, size_t n) |
