Skip to content

Commit

Permalink
* posix/wordexp.c (parse_glob): No need to check ifs for NULL, the
Browse files Browse the repository at this point in the history
	caller makes sure this is not the case.
	(wordexp): Simplify ifs_white creation.  [Coverity CID 231]
  • Loading branch information
Ulrich Drepper committed May 10, 2006
1 parent ecf359c commit 16d620d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2006-05-10 Ulrich Drepper <drepper@redhat.com>

* 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]

2006-05-09 Ulrich Drepper <drepper@redhat.com>

* posix/wordexp.c: Remove numerous NULL pointer tests before FREE
Expand Down
12 changes: 4 additions & 8 deletions posix/wordexp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -2265,26 +2264,23 @@ 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
{
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)
Expand Down

0 comments on commit 16d620d

Please sign in to comment.