changeset 2763:8a832ac25a04

(base_name): Add an assertion.
author Jim Meyering <jim@meyering.net>
date Sun, 23 Jul 2000 09:25:14 +0000
parents 92c29fb3cd91
children 1abd010b93fd
files lib/basename.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lib/basename.c
+++ b/lib/basename.c
@@ -19,6 +19,8 @@
 # include <config.h>
 #endif
 
+#include <assert.h>
+
 #ifndef FILESYSTEM_PREFIX_LEN
 # define FILESYSTEM_PREFIX_LEN(Filename) 0
 #endif
@@ -61,5 +63,8 @@
   if (*base == '\0' && ISSLASH (*name) && all_slashes)
     --base;
 
+  /* Make sure the last byte is not a slash.  */
+  assert (all_slashes || *(p - 1) != '/');
+
   return (char *) base;
 }