summaryrefslogtreecommitdiffstats
path: root/gl/dirname-lgpl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gl/dirname-lgpl.c')
-rw-r--r--gl/dirname-lgpl.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gl/dirname-lgpl.c b/gl/dirname-lgpl.c
index 9e0ec565..9f772e0f 100644
--- a/gl/dirname-lgpl.c
+++ b/gl/dirname-lgpl.c
@@ -1,6 +1,6 @@
1/* dirname.c -- return all but the last element in a file name 1/* dirname.c -- return all but the last element in a file name
2 2
3 Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2025 Free Software 3 Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2026 Free Software
4 Foundation, Inc. 4 Foundation, 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
@@ -32,7 +32,6 @@ size_t
32dir_len (char const *file) 32dir_len (char const *file)
33{ 33{
34 size_t prefix_length = FILE_SYSTEM_PREFIX_LEN (file); 34 size_t prefix_length = FILE_SYSTEM_PREFIX_LEN (file);
35 size_t length;
36 35
37 /* Advance prefix_length beyond important leading slashes. */ 36 /* Advance prefix_length beyond important leading slashes. */
38 prefix_length += (prefix_length != 0 37 prefix_length += (prefix_length != 0
@@ -45,8 +44,10 @@ dir_len (char const *file)
45 : 0)); 44 : 0));
46 45
47 /* Strip the basename and any redundant slashes before it. */ 46 /* Strip the basename and any redundant slashes before it. */
47 size_t length;
48 for (length = last_component (file) - file; 48 for (length = last_component (file) - file;
49 prefix_length < length; length--) 49 prefix_length < length;
50 length--)
50 if (! ISSLASH (file[length - 1])) 51 if (! ISSLASH (file[length - 1]))
51 break; 52 break;
52 return length; 53 return length;