diff options
Diffstat (limited to 'gl/strsep.c')
| -rw-r--r-- | gl/strsep.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gl/strsep.c b/gl/strsep.c index 5a489d11..6338c62d 100644 --- a/gl/strsep.c +++ b/gl/strsep.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* Copyright (C) 2004, 2007, 2009-2025 Free Software Foundation, Inc. | 1 | /* Copyright (C) 2004, 2007, 2009-2026 Free Software Foundation, Inc. |
| 2 | 2 | ||
| 3 | Written by Yoann Vandoorselaere <yoann@prelude-ids.org>. | 3 | Written by Yoann Vandoorselaere <yoann@prelude-ids.org>. |
| 4 | 4 | ||
| @@ -26,7 +26,6 @@ char * | |||
| 26 | strsep (char **stringp, const char *delim) | 26 | strsep (char **stringp, const char *delim) |
| 27 | { | 27 | { |
| 28 | char *start = *stringp; | 28 | char *start = *stringp; |
| 29 | char *ptr; | ||
| 30 | 29 | ||
| 31 | if (start == NULL) | 30 | if (start == NULL) |
| 32 | return NULL; | 31 | return NULL; |
| @@ -38,12 +37,14 @@ strsep (char **stringp, const char *delim) | |||
| 38 | return start; | 37 | return start; |
| 39 | } | 38 | } |
| 40 | 39 | ||
| 40 | char *ptr; | ||
| 41 | /* Optimize the case of one delimiter. */ | 41 | /* Optimize the case of one delimiter. */ |
| 42 | if (delim[1] == '\0') | 42 | if (delim[1] == '\0') |
| 43 | ptr = strchr (start, delim[0]); | 43 | ptr = strchr (start, delim[0]); |
| 44 | else | 44 | else |
| 45 | /* The general case. */ | 45 | /* The general case. */ |
| 46 | ptr = strpbrk (start, delim); | 46 | ptr = strpbrk (start, delim); |
| 47 | |||
| 47 | if (ptr == NULL) | 48 | if (ptr == NULL) |
| 48 | { | 49 | { |
| 49 | *stringp = NULL; | 50 | *stringp = NULL; |
