Changeset 2b3dd78 in mainline for uspace/lib/posix/src/fnmatch.c
- Timestamp:
- 2018-01-31T12:02:00Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5595841
- Parents:
- a0a9cc2 (diff), 14d789c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/src/fnmatch.c
ra0a9cc2 r2b3dd78 42 42 */ 43 43 44 #define LIBPOSIX_INTERNAL45 #define __POSIX_DEF__(x) posix_##x46 47 44 #include "libc/stdbool.h" 48 45 #include "posix/ctype.h" … … 183 180 { "alnum", isalnum }, 184 181 { "alpha", isalpha }, 185 { "blank", posix_isblank },186 { "cntrl", posix_iscntrl },182 { "blank", isblank }, 183 { "cntrl", iscntrl }, 187 184 { "digit", isdigit }, 188 { "graph", posix_isgraph },185 { "graph", isgraph }, 189 186 { "lower", islower }, 190 { "print", posix_isprint },191 { "punct", posix_ispunct },187 { "print", isprint }, 188 { "punct", ispunct }, 192 189 { "space", isspace }, 193 190 { "upper", isupper }, 194 { "xdigit", posix_isxdigit }191 { "xdigit", isxdigit } 195 192 }; 196 193 … … 205 202 { 206 203 const struct _char_class *class = elem; 207 return posix_strcmp((const char *) key, class->name);204 return strcmp((const char *) key, class->name); 208 205 } 209 206 … … 218 215 { 219 216 /* Search for class in the array of supported character classes. */ 220 const struct _char_class *class = posix_bsearch(cname, _char_classes,217 const struct _char_class *class = bsearch(cname, _char_classes, 221 218 sizeof(_char_classes) / sizeof(struct _char_class), 222 219 sizeof(struct _char_class), _class_compare); … … 582 579 { 583 580 assert(s != NULL); 584 char *result = posix_strdup(s);581 char *result = strdup(s); 585 582 for (char *i = result; *i != '\0'; ++i) { 586 583 *i = tolower(*i); … … 598 595 * @return Zero if the string matches the pattern, FNM_NOMATCH otherwise. 599 596 */ 600 int posix_fnmatch(const char *pattern, const char *string, int flags)597 int fnmatch(const char *pattern, const char *string, int flags) 601 598 { 602 599 assert(pattern != NULL); … … 637 634 #undef assert 638 635 #define assert(x) { if (x) printf("SUCCESS: "#x"\n"); else { printf("FAILED: "#x"\n"); fail++; } } 639 #define match(s1, s2, flags) assert( posix_fnmatch(s1, s2, flags) == 0)640 #define nomatch(s1, s2, flags) assert( posix_fnmatch(s1, s2, flags) == FNM_NOMATCH)636 #define match(s1, s2, flags) assert(fnmatch(s1, s2, flags) == 0) 637 #define nomatch(s1, s2, flags) assert(fnmatch(s1, s2, flags) == FNM_NOMATCH) 641 638 642 639 static_assert(FNM_PATHNAME == FNM_FILE_NAME);
Note:
See TracChangeset
for help on using the changeset viewer.