summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-09-11 12:45:32 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-09-17 08:33:11 -0700
commit776e7c4dae63e2541a6f3822c3e9d659f9af101e (patch)
tree1ee0135d7d138aad1837c21d1b985f2820338bde
parent0d1e202f83774543aeb6e66a9dc46160e2bfff5d (diff)
Use standard strrchr() instead of ancient rindex()
As suggested by cppcheck: xditview.c:359:32: style: Obsolescent function 'rindex' called. It is recommended to use 'strrchr' instead. [rindexCalled] if (name[0] != '/' && (n = rindex (name, '/'))) Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--xditview.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/xditview.c b/xditview.c
index 01c528d..1a65771 100644
--- a/xditview.c
+++ b/xditview.c
@@ -37,7 +37,7 @@ from the X Consortium.
#include <X11/StringDefs.h>
#include <X11/Xatom.h>
#include <X11/Shell.h>
-#include <X11/Xos.h> /* rindex declaration */
+#include <X11/Xos.h>
#include <X11/Xaw/Paned.h>
#include <X11/Xaw/Panner.h>
#include <X11/Xaw/Porthole.h>
@@ -356,7 +356,7 @@ VisitFile (char *name, Boolean resetPage)
}
XtSetValues (dvi, arg, i);
XtSetArg (arg[0], XtNtitle, name);
- if (name[0] != '/' && (n = rindex (name, '/')))
+ if (name[0] != '/' && (n = strrchr (name, '/')))
n = n + 1;
else
n = name;