From ac2e8f5a15a968f236387ed98e34b4a9250c9a92 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Fri, 6 Aug 2021 17:52:20 -0700 Subject: Improved, cleaner/faster/more flexible return value checks --- utils.c | 30 ------------------------------ 1 file changed, 30 deletions(-) (limited to 'utils.c') diff --git a/utils.c b/utils.c index 5ecbcf1..cb0719c 100644 --- a/utils.c +++ b/utils.c @@ -128,36 +128,6 @@ char unescapechar(const char *escaped, const char **end) return (char)ret; } -// -// 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 // -- cgit v1.2.3