diff options
author | tobi <tobi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-08-19 09:05:03 +0000 |
---|---|---|
committer | tobi <tobi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-08-19 09:05:03 +0000 |
commit | f3de6ed7b5d88da5ebeecd09c7b42c3b2b85530d (patch) | |
tree | 76fe83ed6ce18e79b36af6aade13bf9037e75278 /gcc/fortran/module.c | |
parent | 53cab91f8b10ef887f9b0de861a445d9fecc6513 (diff) | |
download | gcc-f3de6ed7b5d88da5ebeecd09c7b42c3b2b85530d.tar.gz |
2005-08-19 Steven G. Kargl <kargls@comcast.net>
PR fortran/23065
* gfortran.h: Remove PATH_MAX definition.
* module.c (write_module, gfc_dump_module): Use alloca to allocate
buffers.
* scanner.s (gfc_release_include_path, form_from_filename): Ditto.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103271 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/module.c')
-rw-r--r-- | gcc/fortran/module.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index 58af479b90a..db510fdbc36 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -3479,14 +3479,22 @@ write_module (void) void gfc_dump_module (const char *name, int dump_flag) { - char filename[PATH_MAX], *p; + int n; + char *filename, *p; time_t now; - filename[0] = '\0'; + n = strlen (name) + strlen (MODULE_EXTENSION) + 1; if (gfc_option.module_dir != NULL) - strcpy (filename, gfc_option.module_dir); - - strcat (filename, name); + { + filename = (char *) alloca (n + strlen (gfc_option.module_dir)); + strcpy (filename, gfc_option.module_dir); + strcat (filename, name); + } + else + { + filename = (char *) alloca (n); + strcpy (filename, name); + } strcat (filename, MODULE_EXTENSION); if (!dump_flag) @@ -3532,10 +3540,12 @@ gfc_dump_module (const char *name, int dump_flag) void gfc_use_module (void) { - char filename[GFC_MAX_SYMBOL_LEN + 5]; + char *filename; gfc_state_data *p; int c, line; + filename = (char *) alloca(strlen(module_name) + strlen(MODULE_EXTENSION) + + 1); strcpy (filename, module_name); strcat (filename, MODULE_EXTENSION); |