diff options
Diffstat (limited to 'gl/stripslash.c')
| -rw-r--r-- | gl/stripslash.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/gl/stripslash.c b/gl/stripslash.c index d5b07bca..8f8c38e3 100644 --- a/gl/stripslash.c +++ b/gl/stripslash.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* stripslash.c -- remove redundant trailing slashes from a file name | 1 | /* stripslash.c -- remove redundant trailing slashes from a file name |
| 2 | 2 | ||
| 3 | Copyright (C) 1990, 2001, 2003-2006, 2009-2025 Free Software Foundation, | 3 | Copyright (C) 1990, 2001, 2003-2006, 2009-2026 Free Software Foundation, |
| 4 | Inc. | 4 | Inc. |
| 5 | 5 | ||
| 6 | This file is free software: you can redistribute it and/or modify | 6 | This file is free software: you can redistribute it and/or modify |
| @@ -31,15 +31,13 @@ bool | |||
| 31 | strip_trailing_slashes (char *file) | 31 | strip_trailing_slashes (char *file) |
| 32 | { | 32 | { |
| 33 | char *base = last_component (file); | 33 | char *base = last_component (file); |
| 34 | char *base_lim; | ||
| 35 | bool had_slash; | ||
| 36 | 34 | ||
| 37 | /* last_component returns "" for file system roots, but we need to turn | 35 | /* last_component returns "" for file system roots, but we need to turn |
| 38 | "///" into "/". */ | 36 | "///" into "/". */ |
| 39 | if (! *base) | 37 | if (! *base) |
| 40 | base = file; | 38 | base = file; |
| 41 | base_lim = base + base_len (base); | 39 | char *base_lim = base + base_len (base); |
| 42 | had_slash = (*base_lim != '\0'); | 40 | bool had_slash = (*base_lim != '\0'); |
| 43 | *base_lim = '\0'; | 41 | *base_lim = '\0'; |
| 44 | return had_slash; | 42 | return had_slash; |
| 45 | } | 43 | } |
