aboutsummaryrefslogtreecommitdiff
path: root/gprof
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2000-06-20 12:33:21 +0000
committerAlan Modra <amodra@gmail.com>2000-06-20 12:33:21 +0000
commit2ab47eed68c82a9a6d055ba3f49ca6a8a1dd2575 (patch)
treef16dbfc601991f71c0177a7027479b3d3e3f9247 /gprof
parentb305ef96a167be657a95d273db6945fe7597e937 (diff)
downloadfsf-binutils-gdb-2ab47eed68c82a9a6d055ba3f49ca6a8a1dd2575.zip
fsf-binutils-gdb-2ab47eed68c82a9a6d055ba3f49ca6a8a1dd2575.tar.gz
fsf-binutils-gdb-2ab47eed68c82a9a6d055ba3f49ca6a8a1dd2575.tar.bz2
Correct pointer comparisons relying on NULL less than any other pointer.
Alexander Aganichev's fix for ieee.c
Diffstat (limited to 'gprof')
-rw-r--r--gprof/ChangeLog5
-rw-r--r--gprof/source.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/gprof/ChangeLog b/gprof/ChangeLog
index deec805..400c834 100644
--- a/gprof/ChangeLog
+++ b/gprof/ChangeLog
@@ -1,3 +1,8 @@
+2000-06-20 Alan Modra <alan@linuxcare.com.au>
+
+ * source.c (annotate_source): Correct pointer comparison when
+ checking for backslashes.
+
2000-06-13 H.J. Lu <hjl@gnu.org>
* configure: Regenerate.
diff --git a/gprof/source.c b/gprof/source.c
index 039e876..dd671d5 100644
--- a/gprof/source.c
+++ b/gprof/source.c
@@ -116,7 +116,7 @@ DEFUN (annotate_source, (sf, max_width, annote, arg),
#ifdef HAVE_DOS_BASED_FILE_SYSTEM
{
char *bslash = strrchr (sf->name, '\\');
- if (bslash > name_only)
+ if (name_only == NULL || (bslash != NULL && bslash > name_only))
name_only = bslash;
if (name_only == NULL && sf->name[0] != '\0' && sf->name[1] == ':')
name_only = (char *)sf->name + 1;
@@ -174,7 +174,7 @@ DEFUN (annotate_source, (sf, max_width, annote, arg),
#ifdef HAVE_DOS_BASED_FILE_SYSTEM
{
char *bslash = strrchr (sf->name, '\\');
- if (bslash > filename)
+ if (filename == NULL || (bslash != NULL && bslash > filename))
filename = bslash;
if (filename == NULL && sf->name[0] != '\0' && sf->name[1] == ':')
filename = sf->name + 1;