diff options
author | Doug Evans <dje@google.com> | 2008-04-17 17:43:58 +0000 |
---|---|---|
committer | Doug Evans <dje@google.com> | 2008-04-17 17:43:58 +0000 |
commit | 86991504e78a38eec35bd639142409df56663b0a (patch) | |
tree | b87bc5a6dbbc7aafeb561585d2fe6bee1746aec6 | |
parent | 0a320680e84174e9aa01c6297fe08666720ed7bf (diff) | |
download | gdb-86991504e78a38eec35bd639142409df56663b0a.zip gdb-86991504e78a38eec35bd639142409df56663b0a.tar.gz gdb-86991504e78a38eec35bd639142409df56663b0a.tar.bz2 |
* source.c (find_and_open_source): Add some comments clarifying
handling of FULLNAME argument. Make static. Remove pointless
xstrdup/xfree.
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/source.c | 13 |
2 files changed, 11 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 86a4cbe..28d7ae5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2008-04-17 Doug Evans <dje@google.com> + + * source.c (find_and_open_source): Add some comments clarifying + handling of FULLNAME argument. Make static. Remove pointless + xstrdup/xfree. + 2008-04-17 Pedro Alves <pedro@codesourcery.com> * inf-loop.c (inferior_event_handler): Also run the intermediate diff --git a/gdb/source.c b/gdb/source.c index 2c69547..ceca38b 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -927,15 +927,19 @@ rewrite_source_path (const char *path) DIRNAME is the compilation directory of a particular source file. Only some debug formats provide this info. FULLNAME can be the last known absolute path to the file in question. + Space for the path must have been malloc'd. If a path substitution + is applied we free the old value and set a new one. On Success A valid file descriptor is returned. ( the return value is positive ) FULLNAME is set to the absolute path to the file just opened. + The caller is responsible for freeing FULLNAME. On Failure An invalid file descriptor is returned. ( the return value is negative ) FULLNAME is set to NULL. */ -int + +static int find_and_open_source (struct objfile *objfile, const char *filename, const char *dirname, @@ -1022,13 +1026,6 @@ find_and_open_source (struct objfile *objfile, result = openp (path, OPF_SEARCH_IN_PATH, p, OPEN_MODE, 0, fullname); } - if (result >= 0) - { - char *tmp_fullname; - tmp_fullname = *fullname; - *fullname = xstrdup (tmp_fullname); - xfree (tmp_fullname); - } return result; } |