summary refs log tree commit diff
path: root/sysdeps/generic/strsep.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/generic/strsep.c')
-rw-r--r--sysdeps/generic/strsep.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sysdeps/generic/strsep.c b/sysdeps/generic/strsep.c
index b5ea6ead9d..1c20eb0959 100644
--- a/sysdeps/generic/strsep.c
+++ b/sysdeps/generic/strsep.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1993, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1993, 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -26,7 +26,7 @@ __strsep (char **stringp, const char *delim)
   char *begin, *end;
 
   begin = *stringp;
-  if (! begin || *begin == '\0')
+  if (begin == NULL)
     return NULL;
 
   /* A frequent case is when the delimiter string contains only one
@@ -40,10 +40,10 @@ __strsep (char **stringp, const char *delim)
 	end = NULL;
       else
 	{
-	  while (*begin == ch)
-	    ++begin;
-
-	  end = strchr (begin, delim[0]);
+	  if (*begin == ch)
+	    end = begin;
+	  else
+	    end = strchr (begin, delim[0]);
 	}
     }
   else