Changeset 7f9df7b9 in mainline for uspace/lib/posix/src/fnmatch.c
- Timestamp:
- 2018-01-22T22:42:57Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7a08c70
- Parents:
- e0f47f5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/src/fnmatch.c
re0f47f5 r7f9df7b9 41 41 * will be fairly straightforward. 42 42 */ 43 44 #define LIBPOSIX_INTERNAL45 #define __POSIX_DEF__(x) posix_##x46 43 47 44 #include "libc/stdbool.h" … … 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.