X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fdirname.c;h=3487015343dc0c890294470a7dbf4faccde2663f;hb=559ac9667adc2becf7a2a956f00024b79056469d;hp=eddbe97a2b6eecb657af049218c4f6d9347df77c;hpb=522bc28b315887298fdf24b9cc1a6e17ab221577;p=gnulib.git diff --git a/lib/dirname.c b/lib/dirname.c index eddbe97a2..348701534 100644 --- a/lib/dirname.c +++ b/lib/dirname.c @@ -49,13 +49,15 @@ void *memrchr (); #define BACKSLASH_IS_PATH_SEPARATOR ISSLASH ('\\') -/* Return the length of the directory part of PATH. - Set *RESULT to point to PATH or to `"."', as appropriate. */ +/* Return the length of `dirname (PATH)' and set *RESULT + to point to PATH or to `"."', as appropriate. + Works properly even if there are trailing slashes + (by effectively ignoring them). */ size_t dir_name_r (const char *path, const char **result) { char *slash; - int length; /* Length of result, not including NUL. */ + size_t length; /* Length of result, not including NUL. */ slash = strrchr (path, '/'); if (BACKSLASH_IS_PATH_SEPARATOR)