aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2001-06-12 15:03:04 +0000
committerAndrew Cagney <cagney@redhat.com>2001-06-12 15:03:04 +0000
commit1f8cc6dbc0da3d3248de330289713ab6cebb21f2 (patch)
tree40c8f220f1c6c3ddde20ac7d510fa9d150a6c07a /gdb
parent11f6f21d465eb5e05ff2819ae58ae545c6e15e59 (diff)
downloadgdb-1f8cc6dbc0da3d3248de330289713ab6cebb21f2.zip
gdb-1f8cc6dbc0da3d3248de330289713ab6cebb21f2.tar.gz
gdb-1f8cc6dbc0da3d3248de330289713ab6cebb21f2.tar.bz2
s/char */const char */
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog12
-rw-r--r--gdb/defs.h2
-rw-r--r--gdb/source.c17
-rw-r--r--gdb/symtab.c8
-rw-r--r--gdb/symtab.h4
5 files changed, 29 insertions, 14 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9414c02..6c35cb5 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,15 @@
+Mon Jun 11 17:26:43 2001 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * source.c (openp): Make parameters ``path'' and ``string''
+ constant.
+ (openp): Use alloca to safely duplicate ``string''. Make local
+ variables ``p'' and ``p1'' constant. Delete char* casts.
+ * defs.h: Update.
+
+ * symtab.c (lookup_symtab_1): Make parameter ``name'' constant.
+ (lookup_symtab, lookup_partial_symtab): Ditto.
+ * symtab.h (lookup_symtab, lookup_partial_symtab): Update.
+
2001-06-11 Andrew Cagney <ac131313@redhat.com>
* ui-out.h (ui_out_table_begin): Make char* parameters constant.
diff --git a/gdb/defs.h b/gdb/defs.h
index 1694739..56d8d7b 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -698,7 +698,7 @@ extern void print_address (CORE_ADDR, struct ui_file *);
/* From source.c */
-extern int openp (char *, int, char *, int, int, char **);
+extern int openp (const char *, int, const char *, int, int, char **);
extern int source_full_path_of (char *, char **);
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
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 3b3bb54..4375763 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -79,7 +79,7 @@ static struct partial_symbol *lookup_partial_symbol (struct partial_symtab *,
const char *, int,
namespace_enum);
-static struct symtab *lookup_symtab_1 (char *);
+static struct symtab *lookup_symtab_1 (const char *);
static struct symbol *lookup_symbol_aux (const char *name, const
struct block *block, const
@@ -138,7 +138,7 @@ cplusplus_hint (char *name)
in the symtab filename will also work. */
static struct symtab *
-lookup_symtab_1 (char *name)
+lookup_symtab_1 (const char *name)
{
register struct symtab *s;
register struct partial_symtab *ps;
@@ -192,7 +192,7 @@ got_symtab:
of variations if the first lookup doesn't work. */
struct symtab *
-lookup_symtab (char *name)
+lookup_symtab (const char *name)
{
register struct symtab *s;
#if 0
@@ -229,7 +229,7 @@ lookup_symtab (char *name)
in the psymtab filename will also work. */
struct partial_symtab *
-lookup_partial_symtab (char *name)
+lookup_partial_symtab (const char *name)
{
register struct partial_symtab *pst;
register struct objfile *objfile;
diff --git a/gdb/symtab.h b/gdb/symtab.h
index f760628..d85add3 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -1072,7 +1072,7 @@ extern int asm_demangle;
/* lookup a symbol table by source file name */
-extern struct symtab *lookup_symtab (char *);
+extern struct symtab *lookup_symtab (const char *);
/* lookup a symbol by name (optional block, optional symtab) */
@@ -1122,7 +1122,7 @@ find_pc_sect_partial_function (CORE_ADDR, asection *,
/* lookup partial symbol table by filename */
-extern struct partial_symtab *lookup_partial_symtab (char *);
+extern struct partial_symtab *lookup_partial_symtab (const char *);
/* lookup partial symbol table by address */