aboutsummaryrefslogtreecommitdiff
path: root/gdb/source.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2012-04-17 15:45:12 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2012-04-17 15:45:12 +0000
commit5ee4ed9f2eeafe7f0be32e0d197240e2b52c6d41 (patch)
treedd7f5c70825c47ac7b00bab18219170487edcdad /gdb/source.c
parent0b649256e38bd4c7242c964b1f6d31e6619db81e (diff)
downloadgdb-5ee4ed9f2eeafe7f0be32e0d197240e2b52c6d41.zip
gdb-5ee4ed9f2eeafe7f0be32e0d197240e2b52c6d41.tar.gz
gdb-5ee4ed9f2eeafe7f0be32e0d197240e2b52c6d41.tar.bz2
gdb/
Code cleanup. * source.c (add_path): Remove always true conditional 'p == 0' and unindent its code block.
Diffstat (limited to 'gdb/source.c')
-rw-r--r--gdb/source.c53
1 files changed, 25 insertions, 28 deletions
diff --git a/gdb/source.c b/gdb/source.c
index 9b464f9..8e7acf8 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -573,6 +573,7 @@ add_path (char *dirname, char **which_path, int parse_separators)
append:
{
unsigned int len = strlen (name);
+ char tinybuf[2];
p = *which_path;
while (1)
@@ -596,37 +597,33 @@ add_path (char *dirname, char **which_path, int parse_separators)
else
break;
}
- if (p == 0)
- {
- char tinybuf[2];
- tinybuf[0] = DIRNAME_SEPARATOR;
- tinybuf[1] = '\0';
+ tinybuf[0] = DIRNAME_SEPARATOR;
+ tinybuf[1] = '\0';
- /* If we have already tacked on a name(s) in this command,
- be sure they stay on the front as we tack on some
- more. */
- if (prefix)
- {
- char *temp, c;
-
- c = old[prefix];
- old[prefix] = '\0';
- temp = concat (old, tinybuf, name, (char *)NULL);
- old[prefix] = c;
- *which_path = concat (temp, "", &old[prefix], (char *) NULL);
- prefix = strlen (temp);
- xfree (temp);
- }
- else
- {
- *which_path = concat (name, (old[0] ? tinybuf : old),
- old, (char *)NULL);
- prefix = strlen (name);
- }
- xfree (old);
- old = *which_path;
+ /* If we have already tacked on a name(s) in this command,
+ be sure they stay on the front as we tack on some
+ more. */
+ if (prefix)
+ {
+ char *temp, c;
+
+ c = old[prefix];
+ old[prefix] = '\0';
+ temp = concat (old, tinybuf, name, (char *)NULL);
+ old[prefix] = c;
+ *which_path = concat (temp, "", &old[prefix], (char *) NULL);
+ prefix = strlen (temp);
+ xfree (temp);
+ }
+ else
+ {
+ *which_path = concat (name, (old[0] ? tinybuf : old),
+ old, (char *)NULL);
+ prefix = strlen (name);
}
+ xfree (old);
+ old = *which_path;
}
skip_dup:
;