diff options
author | Andrew Cagney <cagney@redhat.com> | 2001-06-12 15:03:04 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2001-06-12 15:03:04 +0000 |
commit | 1f8cc6dbc0da3d3248de330289713ab6cebb21f2 (patch) | |
tree | 40c8f220f1c6c3ddde20ac7d510fa9d150a6c07a /gdb/source.c | |
parent | 11f6f21d465eb5e05ff2819ae58ae545c6e15e59 (diff) | |
download | gdb-1f8cc6dbc0da3d3248de330289713ab6cebb21f2.zip gdb-1f8cc6dbc0da3d3248de330289713ab6cebb21f2.tar.gz gdb-1f8cc6dbc0da3d3248de330289713ab6cebb21f2.tar.bz2 |
s/char */const char */
Diffstat (limited to 'gdb/source.c')
-rw-r--r-- | gdb/source.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/gdb/source.c b/gdb/source.c index ebc82dc..8d705db 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -515,12 +515,14 @@ source_info (char *ignore, int from_tty) /* >>>> This should only allow files of certain types, >>>> eg executable, non-directory */ int -openp (char *path, int try_cwd_first, char *string, int mode, int prot, +openp (const char *path, int try_cwd_first, const char *string, + int mode, int prot, char **filename_opened) { register int fd; register char *filename; - register char *p, *p1; + const char *p; + const char *p1; register int len; int alloclen; @@ -534,7 +536,8 @@ openp (char *path, int try_cwd_first, char *string, int mode, int prot, if (try_cwd_first || IS_ABSOLUTE_PATH (string)) { int i; - filename = string; + filename = alloca (strlen (string) + 1); + strcpy (filename, string); fd = open (filename, mode, prot); if (fd >= 0) goto done; @@ -548,11 +551,11 @@ openp (char *path, int try_cwd_first, char *string, int mode, int prot, string += 2; alloclen = strlen (path) + strlen (string) + 2; - filename = (char *) alloca (alloclen); + filename = alloca (alloclen); fd = -1; for (p = path; p; p = p1 ? p1 + 1 : 0) { - p1 = (char *) strchr (p, DIRNAME_SEPARATOR); + p1 = strchr (p, DIRNAME_SEPARATOR); if (p1) len = p1 - p; else @@ -570,7 +573,7 @@ openp (char *path, int try_cwd_first, char *string, int mode, int prot, if (newlen > alloclen) { alloclen = newlen; - filename = (char *) alloca (alloclen); + filename = alloca (alloclen); } strcpy (filename, current_directory); } @@ -597,7 +600,7 @@ done: if (filename_opened) { if (fd < 0) - *filename_opened = (char *) 0; + *filename_opened = NULL; else if (IS_ABSOLUTE_PATH (filename)) *filename_opened = savestring (filename, strlen (filename)); else |