aboutsummaryrefslogtreecommitdiff
path: root/gprof/source.c
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/source.c
parentb305ef96a167be657a95d273db6945fe7597e937 (diff)
downloadgdb-2ab47eed68c82a9a6d055ba3f49ca6a8a1dd2575.zip
gdb-2ab47eed68c82a9a6d055ba3f49ca6a8a1dd2575.tar.gz
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/source.c')
-rw-r--r--gprof/source.c4
1 files changed, 2 insertions, 2 deletions
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;