comparison libnnchat.c @ 372:b9f0bdad6285

Use th_strcasecmp() and th_strncasecmp().
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 23 Jun 2011 14:43:10 +0300
parents 88ac689d11bc
children 812af6823eb7
comparison
equal deleted inserted replaced
371:080cd5154522 372:b9f0bdad6285
868 868
869 hash = nn_hash_user(name); 869 hash = nn_hash_user(name);
870 if (list->buckets[hash] != NULL) { 870 if (list->buckets[hash] != NULL) {
871 nn_user_t *curr = list->buckets[hash]; 871 nn_user_t *curr = list->buckets[hash];
872 while (curr != NULL) { 872 while (curr != NULL) {
873 if (strcasecmp(curr->name, name) == 0) 873 if (th_strcasecmp(curr->name, name) == 0)
874 return curr; 874 return curr;
875 curr = curr->next; 875 curr = curr->next;
876 } 876 }
877 } 877 }
878 878
882 882
883 static nn_user_t *nn_user_match_do(nn_user_t *list, const char *pattern, size_t len) 883 static nn_user_t *nn_user_match_do(nn_user_t *list, const char *pattern, size_t len)
884 { 884 {
885 nn_user_t *curr = list; 885 nn_user_t *curr = list;
886 while (curr != NULL) { 886 while (curr != NULL) {
887 if (len <= strlen(curr->name) && strncasecmp(curr->name, pattern, len) == 0) 887 if (len <= strlen(curr->name) && th_strncasecmp(curr->name, pattern, len) == 0)
888 return curr; 888 return curr;
889 curr = curr->next; 889 curr = curr->next;
890 } 890 }
891 return NULL; 891 return NULL;
892 } 892 }
904 size_t len = strlen(pattern); 904 size_t len = strlen(pattern);
905 905
906 if (current != NULL) { 906 if (current != NULL) {
907 nn_user_t *found = NULL; 907 nn_user_t *found = NULL;
908 while (curr != NULL) { 908 while (curr != NULL) {
909 if (strcasecmp(curr->name, current) == 0) { 909 if (th_strcasecmp(curr->name, current) == 0) {
910 if (again) 910 if (again)
911 return curr; 911 return curr;
912 found = curr->next; 912 found = curr->next;
913 break; 913 break;
914 } 914 }
974 if (list->buckets[hash] != NULL) { 974 if (list->buckets[hash] != NULL) {
975 nn_user_t *curr, *prev; 975 nn_user_t *curr, *prev;
976 curr = list->buckets[hash]; 976 curr = list->buckets[hash];
977 prev = NULL; 977 prev = NULL;
978 while (curr != NULL) { 978 while (curr != NULL) {
979 if (strcasecmp(curr->name, name) == 0) { 979 if (th_strcasecmp(curr->name, name) == 0) {
980 if (prev) 980 if (prev)
981 prev->next = curr->next; 981 prev->next = curr->next;
982 else 982 else
983 list->buckets[hash] = curr->next; 983 list->buckets[hash] = curr->next;
984 984