From 745a5487c9da077893a46d26d64e911246640a7b Mon Sep 17 00:00:00 2001 From: John Darrington Date: Tue, 4 Apr 2006 07:30:46 +0000 Subject: [PATCH] Fixed bug in fn_interp_vars --- src/data/ChangeLog | 4 ++++ src/data/filename.c | 32 ++++++++++++++++++-------------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/data/ChangeLog b/src/data/ChangeLog index 669836c6..35a8ed1e 100644 --- a/src/data/ChangeLog +++ b/src/data/ChangeLog @@ -1,3 +1,7 @@ +Tue Apr 4 15:28:40 WST 2006 John Darrington + + * filename.ch (fn_interp_vars): Fixed small buglet. + Tue Mar 28 13:47:16 WST 2006 John Darrington * filename.[ch] (fn_interp_vars): Changed the signature and semantics diff --git a/src/data/filename.c b/src/data/filename.c index 728585df..323a78c5 100644 --- a/src/data/filename.c +++ b/src/data/filename.c @@ -78,12 +78,15 @@ fn_init (void) */ void fn_interp_vars (struct string *target, - const char *(*getenv) (const char *)) + const char *(*getenv) (const char *)) { + char *input ; + char *s ; + assert (target); - char *input = xmalloc(ds_length(target) + 1); - char *s = input; + input = xmalloc(ds_length(target) + 1); + s = input; strcpy(input, ds_c_str(target)); @@ -141,6 +144,7 @@ fn_interp_vars (struct string *target, if (stop && *s == stop) s++; } + break; default: ds_putc (target, *s++); @@ -592,10 +596,10 @@ fn_get_cwd (void) int size = 2; char *buffer = xmalloc (size); if ( buffer) - { - buffer[0]='.'; - buffer[1]='\0'; - } + { + buffer[0]='.'; + buffer[1]='\0'; + } return buffer; @@ -889,10 +893,10 @@ fn_close_ext (struct file_ext *f) #ifdef unix /* A file's identity. */ struct file_identity - { - dev_t device; /* Device number. */ - ino_t inode; /* Inode number. */ - }; +{ + dev_t device; /* Device number. */ + ino_t inode; /* Inode number. */ +}; /* Returns a pointer to a dynamically allocated structure whose value can be used to tell whether two files are actually the @@ -938,9 +942,9 @@ fn_compare_file_identities (const struct file_identity *a, #else /* not unix */ /* A file's identity. */ struct file_identity - { - char *normalized_filename; /* File's normalized name. */ - }; +{ + char *normalized_filename; /* File's normalized name. */ +}; /* Returns a pointer to a dynamically allocated structure whose value can be used to tell whether two files are actually the -- 2.30.2