]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[core] use the more efficient mult-byte tolower/toupper in the helper func
authorAnthony Minessale <anthm@signalwire.com>
Thu, 28 May 2020 21:35:00 +0000 (21:35 +0000)
committerAndrey Volk <andywolk@gmail.com>
Sat, 23 Oct 2021 19:00:09 +0000 (22:00 +0300)
src/include/switch_utils.h

index 649ad926b36009052b6b2f1af95ea8a3dc0bb6c7..41b2436538fd6432be97f6b84f0c11f543abbaf8 100644 (file)
@@ -888,13 +888,10 @@ static inline char *switch_safe_strdup(const char *it)
 static inline char *switch_lc_strdup(const char *it)
 {
        char *dup;
-       char *p;
 
        if (it) {
                dup = strdup(it);
-               for (p = dup; p && *p; p++) {
-                       *p = (char) switch_tolower(*p);
-               }
+               switch_tolower_max(dup);
                return dup;
        }
 
@@ -905,13 +902,10 @@ static inline char *switch_lc_strdup(const char *it)
 static inline char *switch_uc_strdup(const char *it)
 {
        char *dup;
-       char *p;
 
        if (it) {
                dup = strdup(it);
-               for (p = dup; p && *p; p++) {
-                       *p = (char) switch_toupper(*p);
-               }
+               switch_toupper_max(dup);
                return dup;
        }