Changeset 2b3dd78 in mainline for uspace/lib/posix/src/fnmatch.c


Ignore:
Timestamp:
2018-01-31T12:02:00Z (8 years ago)
Author:
Jenda <jenda.jzqk73@…>
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.
Message:

Merge remote-tracking branch 'upstream/master' into forwardport

change tmon includes because of new stdlib

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/posix/src/fnmatch.c

    ra0a9cc2 r2b3dd78  
    4242 */
    4343
    44 #define LIBPOSIX_INTERNAL
    45 #define __POSIX_DEF__(x) posix_##x
    46 
    4744#include "libc/stdbool.h"
    4845#include "posix/ctype.h"
     
    183180        { "alnum", isalnum },
    184181        { "alpha", isalpha },
    185         { "blank", posix_isblank },
    186         { "cntrl", posix_iscntrl },
     182        { "blank", isblank },
     183        { "cntrl", iscntrl },
    187184        { "digit", isdigit },
    188         { "graph", posix_isgraph },
     185        { "graph", isgraph },
    189186        { "lower", islower },
    190         { "print", posix_isprint },
    191         { "punct", posix_ispunct },
     187        { "print", isprint },
     188        { "punct", ispunct },
    192189        { "space", isspace },
    193190        { "upper", isupper },
    194         { "xdigit", posix_isxdigit }
     191        { "xdigit", isxdigit }
    195192};
    196193
     
    205202{
    206203        const struct _char_class *class = elem;
    207         return posix_strcmp((const char *) key, class->name);
     204        return strcmp((const char *) key, class->name);
    208205}
    209206
     
    218215{
    219216        /* 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,
    221218            sizeof(_char_classes) / sizeof(struct _char_class),
    222219            sizeof(struct _char_class), _class_compare);
     
    582579{
    583580        assert(s != NULL);
    584         char *result = posix_strdup(s);
     581        char *result = strdup(s);
    585582        for (char *i = result; *i != '\0'; ++i) {
    586583                *i = tolower(*i);
     
    598595 * @return Zero if the string matches the pattern, FNM_NOMATCH otherwise.
    599596 */
    600 int posix_fnmatch(const char *pattern, const char *string, int flags)
     597int fnmatch(const char *pattern, const char *string, int flags)
    601598{
    602599        assert(pattern != NULL);
     
    637634        #undef assert
    638635        #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)
    641638
    642639        static_assert(FNM_PATHNAME == FNM_FILE_NAME);
Note: See TracChangeset for help on using the changeset viewer.