diff options
author | Paul Smith <psmith@gnu.org> | 2006-02-20 02:14:00 +0000 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2006-02-20 02:14:00 +0000 |
commit | 6e0527913c6724fa92e2135de991e27df54c4289 (patch) | |
tree | c9e4c448ae4476e5ef81ca5a5ca8feb344e519c7 /file.c | |
parent | bde826b18aeb6fd3c9de7a7733d1e163efde90e1 (diff) | |
download | gunmake-6e0527913c6724fa92e2135de991e27df54c4289.tar.gz |
- Memory cleanups, found with valgrind.
- Fix handling of special targets like .SUFFIX for VMS insensitive targets.
- Don't make temporary batch files for -n. Make sure batch files are created
in text mode.
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 54 |
1 files changed, 29 insertions, 25 deletions
@@ -88,14 +88,15 @@ lookup_file (char *name) on the command line. */ #ifdef VMS # ifndef WANT_CASE_SENSITIVE_TARGETS - { - register char *n; - lname = (char *) malloc (strlen (name) + 1); - for (n = name, ln = lname; *n != '\0'; ++n, ++ln) - *ln = isupper ((unsigned char)*n) ? tolower ((unsigned char)*n) : *n; - *ln = '\0'; - name = lname; - } + if (*name != '.') + { + register char *n; + lname = (char *) malloc (strlen (name) + 1); + for (n = name, ln = lname; *n != '\0'; ++n, ++ln) + *ln = isupper ((unsigned char)*n) ? tolower ((unsigned char)*n) : *n; + *ln = '\0'; + name = lname; + } # endif while (name[0] == '[' && name[1] == ']' && name[2] != '\0') @@ -124,7 +125,8 @@ lookup_file (char *name) file_key.hname = name; f = (struct file *) hash_find_item (&files, &file_key); #if defined(VMS) && !defined(WANT_CASE_SENSITIVE_TARGETS) - free (lname); + if (*name != '.') + free (lname); #endif return f; } @@ -143,22 +145,23 @@ enter_file (char *name) assert (*name != '\0'); #if defined(VMS) && !defined(WANT_CASE_SENSITIVE_TARGETS) - { - register char *n; - lname = (char *) malloc (strlen (name) + 1); - for (n = name, ln = lname; *n != '\0'; ++n, ++ln) - { - if (isupper ((unsigned char)*n)) - *ln = tolower ((unsigned char)*n); - else - *ln = *n; - } + if (*name != '.') + { + register char *n; + lname = (char *) malloc (strlen (name) + 1); + for (n = name, ln = lname; *n != '\0'; ++n, ++ln) + { + if (isupper ((unsigned char)*n)) + *ln = tolower ((unsigned char)*n); + else + *ln = *n; + } - *ln = 0; - /* Creates a possible leak, old value of name is unreachable, but I - currently don't know how to fix it. */ - name = lname; - } + *ln = 0; + /* Creates a possible leak, old value of name is unreachable, but I + currently don't know how to fix it. */ + name = lname; + } #endif file_key.hname = name; @@ -167,7 +170,8 @@ enter_file (char *name) if (! HASH_VACANT (f) && !f->double_colon) { #if defined(VMS) && !defined(WANT_CASE_SENSITIVE_TARGETS) - free(lname); + if (*name != '.') + free (lname); #endif return f; } |