changeset 372:b9f0bdad6285

Use th_strcasecmp() and th_strncasecmp().
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 23 Jun 2011 14:43:10 +0300
parents 080cd5154522
children ebbe97f2a2a5
files libnnchat.c nnchat.c
diffstat 2 files changed, 16 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/libnnchat.c	Thu Jun 23 12:54:18 2011 +0300
+++ b/libnnchat.c	Thu Jun 23 14:43:10 2011 +0300
@@ -870,7 +870,7 @@
     if (list->buckets[hash] != NULL) {
         nn_user_t *curr = list->buckets[hash];
         while (curr != NULL) {
-            if (strcasecmp(curr->name, name) == 0)
+            if (th_strcasecmp(curr->name, name) == 0)
                 return curr;
             curr = curr->next;
         }
@@ -884,7 +884,7 @@
 {
     nn_user_t *curr = list;
     while (curr != NULL) {
-        if (len <= strlen(curr->name) && strncasecmp(curr->name, pattern, len) == 0)
+        if (len <= strlen(curr->name) && th_strncasecmp(curr->name, pattern, len) == 0)
             return curr;
         curr = curr->next;
     }
@@ -906,7 +906,7 @@
         if (current != NULL) {
             nn_user_t *found = NULL;
             while (curr != NULL) {
-                if (strcasecmp(curr->name, current) == 0) {
+                if (th_strcasecmp(curr->name, current) == 0) {
                     if (again)
                         return curr;
                     found = curr->next;
@@ -976,7 +976,7 @@
         curr = list->buckets[hash];
         prev = NULL;
         while (curr != NULL) {
-            if (strcasecmp(curr->name, name) == 0) {
+            if (th_strcasecmp(curr->name, name) == 0) {
                 if (prev)
                     prev->next = curr->next;
                 else
--- a/nnchat.c	Thu Jun 23 12:54:18 2011 +0300
+++ b/nnchat.c	Thu Jun 23 14:43:10 2011 +0300
@@ -218,7 +218,7 @@
     for (i = 0; i < SET_MAX_WINDOWS; i++)
         if (chatWindows[i] != NULL &&
             chatWindows[i]->id != NULL &&
-            strcasecmp(id, chatWindows[i]->id) == 0)
+            th_strcasecmp(id, chatWindows[i]->id) == 0)
             return chatWindows[i];
 
     return NULL;
@@ -575,7 +575,7 @@
 {
     qlist_t *node = setIgnoreList;
     while (node != NULL) {
-        if (strcasecmp(name, (char *) node->data) == 0)
+        if (th_strcasecmp(name, (char *) node->data) == 0)
             return TRUE;
         node = node->next;
     }
@@ -820,7 +820,7 @@
 
 int compareUsername(const void *s1, const void *s2)
 {
-    return strcasecmp((char *) s1, (char *) s2);
+    return th_strcasecmp((char *) s1, (char *) s2);
 }
 
 int handleUserInput(nn_conn_t *conn, char *buf, size_t bufLen)
@@ -841,7 +841,7 @@
     if (*buf == 0) {
         return 1;
     }
-    else if (!strncasecmp(buf, "/color ", 7)) {
+    else if (!th_strncasecmp(buf, "/color ", 7)) {
         /* Change color */
         int tmpInt;
         if ((tmpInt = th_get_hex_triplet(trimLeft(buf + 7))) < 0) {
@@ -853,7 +853,7 @@
         nn_conn_send_msg(conn, optUserNameEnc, "%%2FSetFontColor%%20%%2Dcolor%%20%06X", optUserColor);
         return 0;
     }
-    else if (!strncasecmp(buf, "/ignore", 7)) {
+    else if (!th_strncasecmp(buf, "/ignore", 7)) {
         char *name = trimLeft(buf + 7);
         if (strlen(name) > 0) {
             /* Add or remove someone to/from ignore */
@@ -883,7 +883,7 @@
         }
         return 0;
     }
-    else if (!strncasecmp(buf, "/query", 6)) {
+    else if (!th_strncasecmp(buf, "/query", 6)) {
         char *name = trimLeft(buf + 6);
         if (strlen(name) > 0) {
             nn_user_t *user = nn_user_find(nnUsers, nn_username_encode(name));
@@ -901,7 +901,7 @@
         }
         return 0;
     }
-    else if (!strncasecmp(buf, "/win", 4)) {
+    else if (!th_strncasecmp(buf, "/win", 4)) {
         /* Change color */
         char *tmp = trimLeft(buf + 4);
         if (strlen(tmp) > 0) {
@@ -919,7 +919,7 @@
         }
         return 0;
     }
-    else if (!strncasecmp(buf, "/close", 6)) {
+    else if (!th_strncasecmp(buf, "/close", 6)) {
         char *name = trimLeft(buf + 6);
         if (strlen(name) > 0) {
             nn_window_t *win = findWindow(name);
@@ -937,7 +937,7 @@
         }
         return 0;
     }
-    else if (!strncasecmp(buf, "/save", 5)) {
+    else if (!th_strncasecmp(buf, "/save", 5)) {
         /* Save configuration */
         FILE *cfgfile = fopen(setConfigFile, "w");
         if (cfgfile == NULL) {
@@ -952,7 +952,7 @@
         fclose(cfgfile);
         return 0;
     }
-    else if (!strncasecmp(buf, "/w ", 3)) {
+    else if (!th_strncasecmp(buf, "/w ", 3)) {
         /* Open given username's profile via firefox in a new tab */
         char *name = trimLeft(buf + 3);
 
@@ -996,7 +996,7 @@
 #endif
         return 0;
     }
-    else if (!strncasecmp(buf, "/who", 4)) {
+    else if (!th_strncasecmp(buf, "/who", 4)) {
         /* Alias /who to /listallusers */
         snprintf(tmpBuf, sizeof(tmpBuf), "/listallusers");
         buf = tmpBuf;
@@ -1107,7 +1107,7 @@
     if (newPattern) {
         /* Get pattern, check if it matches previous pattern and set 'again' flag */
         char *npattern = nn_editbuf_get_string(buf, startPos, endPos);
-        if (pattern && npattern && strcasecmp(npattern, pattern) == 0)
+        if (pattern && npattern && th_strcasecmp(npattern, pattern) == 0)
             again = TRUE;
         
         th_free(pattern);