Merge the two copies of strcmp_underscore().
[cparser] / adt / strutil.c
1 #include "strutil.h"
2
3
4 int strcmp_underscore(const char *const s1, const char *const s2)
5 {
6         if (s2[0] == '_' && s2[1] == '_') {
7                 size_t len2 = strlen(s2);
8                 size_t len1 = strlen(s1);
9                 if (len1 == len2 - 4 && s2[len2 - 2] == '_' && s2[len2 - 1] == '_') {
10                         return strncmp(s1, s2 + 2, len2 - 4);
11                 }
12         }
13
14         return strcmp(s1, s2);
15 }