diff options
author | Ulrich Drepper <drepper@redhat.com> | 2006-05-10 14:48:09 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2006-05-10 14:48:09 +0000 |
commit | 16d620db9420274f2f66747d8c0f3601b520bea8 (patch) | |
tree | 4b1e9d0c27df42575607e6d28f84b35289831524 /posix/wordexp.c | |
parent | ecf359c68b2baf1bd76f8c5ff132b8c1a256056b (diff) | |
download | glibc-16d620db9420274f2f66747d8c0f3601b520bea8.tar glibc-16d620db9420274f2f66747d8c0f3601b520bea8.tar.gz glibc-16d620db9420274f2f66747d8c0f3601b520bea8.tar.bz2 glibc-16d620db9420274f2f66747d8c0f3601b520bea8.zip |
* posix/wordexp.c (parse_glob): No need to check ifs for NULL, the
caller makes sure this is not the case.
(wordexp): Simplify ifs_white creation. [Coverity CID 231]
Diffstat (limited to 'posix/wordexp.c')
-rw-r--r-- | posix/wordexp.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/posix/wordexp.c b/posix/wordexp.c index 188e710037..adece95ef8 100644 --- a/posix/wordexp.c +++ b/posix/wordexp.c @@ -453,8 +453,7 @@ parse_glob (char **word, size_t *word_length, size_t *max_length, glob_list.we_offs = 0; for (; words[*offset] != '\0'; ++*offset) { - if ((ifs && strchr (ifs, words[*offset])) || - (!ifs && strchr (" \t\n", words[*offset]))) + if (strchr (ifs, words[*offset]) != NULL) /* Reached IFS */ break; @@ -2265,7 +2264,7 @@ wordexp (const char *words, wordexp_t *pwordexp, int flags) */ ifs = getenv ("IFS"); - if (!ifs) + if (ifs == NULL) /* IFS unset - use <space><tab><newline>. */ ifs = strcpy (ifs_white, " \t\n"); else @@ -2273,18 +2272,15 @@ wordexp (const char *words, wordexp_t *pwordexp, int flags) char *ifsch = ifs; char *whch = ifs_white; - /* Start off with no whitespace IFS characters */ - ifs_white[0] = '\0'; - while (*ifsch != '\0') { - if ((*ifsch == ' ') || (*ifsch == '\t') || (*ifsch == '\n')) + if (*ifsch == ' ' || *ifsch == '\t' || *ifsch == '\n') { /* Whitespace IFS. See first whether it is already in our collection. */ char *runp = ifs_white; - while (runp < whch && *runp != '\0' && *runp != *ifsch) + while (runp < whch && *runp != *ifsch) ++runp; if (runp == whch) |