You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2012/12/14 21:20:52 UTC

svn commit: r1422066 - /qpid/proton/trunk/proton-c/src/util.c

Author: astitcher
Date: Fri Dec 14 20:20:51 2012
New Revision: 1422066

URL: http://svn.apache.org/viewvc?rev=1422066&view=rev
Log:
PROTON-121: Replaced use of strcasecmp() with ANSI C.

Modified:
    qpid/proton/trunk/proton-c/src/util.c

Modified: qpid/proton/trunk/proton-c/src/util.c
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/util.c?rev=1422066&r1=1422065&r2=1422066&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/src/util.c (original)
+++ qpid/proton/trunk/proton-c/src/util.c Fri Dec 14 20:20:51 2012
@@ -132,11 +132,20 @@ void pn_fatal(char *fmt, ...)
   va_end(ap);
 }
 
+static bool pn_i_eq_nocase(const char *a, const char *b)
+{
+    while (*b) {
+        if (tolower(*a++) != tolower(*b++))
+            return false;
+    }
+    return !(*a);
+}
+
 bool pn_env_bool(const char *name)
 {
   char *v = getenv(name);
-  return v && (!strcasecmp(v, "true") || !strcasecmp(v, "1") ||
-               !strcasecmp(v, "yes"));
+  return v && (pn_i_eq_nocase(v, "true") || pn_i_eq_nocase(v, "1") ||
+               pn_i_eq_nocase(v, "yes") || pn_i_eq_nocase(v, "on"));
 }
 
 char *pn_strdup(const char *src)



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org