From: Chas Williams <3chas3@gmail.com> Date: Sat, 25 Apr 2015 20:53:43 +0000 (-0400) Subject: opr: Use opr_Assert() instead of silently failing X-Git-Tag: openafs-stable-1_8_0pre1~165 X-Git-Url: http://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=775b8873f45ef563b5caaae9911acd91232f9966;hp=04661c4139b3f0bc7d44a43160c9a0ac1405ca5e opr: Use opr_Assert() instead of silently failing These routines should never be passed a NULL. If this happens it is a serious issue that needs to be addressed. Change-Id: I9728dcd67bc9f8e9927bed1674fc0ee83567df1a Reviewed-on: http://gerrit.openafs.org/11853 Tested-by: BuildBot Tested-by: Benjamin Kaduk Reviewed-by: Michael Meffie Reviewed-by: Benjamin Kaduk --- diff --git a/src/opr/casestrcpy.c b/src/opr/casestrcpy.c index e1dc37a..37f5c4c 100644 --- a/src/opr/casestrcpy.c +++ b/src/opr/casestrcpy.c @@ -23,8 +23,7 @@ lcstring(char *d, const char *s, int n) char *original_d = d; char c; - if ((s == 0) || (d == 0)) - return 0; /* just to be safe */ + opr_Assert(s != NULL && d != NULL); while (n) { c = *s++; if (isupper(c)) @@ -44,8 +43,7 @@ ucstring(char *d, const char *s, int n) char *original_d = d; char c; - if ((s == 0) || (d == 0)) - return 0; + opr_Assert(s != NULL && d != NULL); while (n) { c = *s++; if (islower(c)) @@ -97,7 +95,8 @@ strcompose(char *buf, size_t len, ...) char *str; size_t slen; - if (buf == NULL || len <= 0) + opr_Assert(buf != NULL); + if (len <= 0) return NULL; *buf = '\0';