From db0b6d3c80bbedfa656f0565304fbb0a360c759a Mon Sep 17 00:00:00 2001 From: James Youngman Date: Sat, 2 Apr 2011 14:10:12 +0100 Subject: [PATCH 07/10] Remove duplicate definition of mdir_name() To: address@hidden --- find/pred.c | 33 --------------------------------- 1 files changed, 0 insertions(+), 33 deletions(-) diff --git a/find/pred.c b/find/pred.c index d98c4dc..2f61499 100644 --- a/find/pred.c +++ b/find/pred.c @@ -501,39 +501,6 @@ pred_empty (const char *pathname, struct stat *stat_buf, struct predicate *pred_ } -/* In general, we can't use the builtin `dirname' function if available, - since it has different meanings in different environments. - In some environments the builtin `dirname' modifies its argument. - - Return the leading directories part of FILE, allocated with malloc. - Works properly even if there are trailing slashes (by effectively - ignoring them). Return NULL on failure. - - If lstat (FILE) would succeed, then { chdir (dir_name (FILE)); - lstat (base_name (FILE)); } will access the same file. Likewise, - if the sequence { chdir (dir_name (FILE)); - rename (base_name (FILE), "foo"); } succeeds, you have renamed FILE - to "foo" in the same directory FILE was in. */ - -static char * -mdir_name (char const *file) -{ - size_t length = dir_len (file); - bool append_dot = (length == 0 - || (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE - && length == FILE_SYSTEM_PREFIX_LEN (file) - && file[2] != '\0' && ! ISSLASH (file[2]))); - char *dir = malloc (length + append_dot + 1); - if (!dir) - return NULL; - memcpy (dir, file, length); - if (append_dot) - dir[length++] = '.'; - dir[length] = '\0'; - return dir; -} - - /* Initialise exec->wd_for_exec. We save in exec->wd_for_exec the directory whose path relative to -- 1.7.2.5