From cbe7e9daec1c908c9a21e8d3909366ad7cddbf15 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 14 Jan 2003 15:07:24 +0000 Subject: (same_name): Declare *_basename locals to be `const'. Consolidate declarations and initializations of *_base* locals. --- lib/same.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/same.c b/lib/same.c index 8b4985de5..d41cccc46 100644 --- a/lib/same.c +++ b/lib/same.c @@ -64,14 +64,12 @@ void free (); int same_name (const char *source, const char *dest) { - char *source_basename, *dest_basename; - size_t source_baselen, dest_baselen; - /* Compare the basenames. */ - source_basename = base_name (source); - dest_basename = base_name (dest); - source_baselen = base_len (source_basename); - dest_baselen = base_len (dest_basename); + char const *source_basename = base_name (source); + char const *dest_basename = base_name (dest); + size_t source_baselen = base_len (source_basename); + size_t dest_baselen = base_len (dest_basename); + if (source_baselen == dest_baselen && memcmp (source_basename, dest_basename, dest_baselen) == 0) { -- cgit v1.2.3-70-g09d2