From 6bedc77b34297569b0f169f269b8309eba35f555 Mon Sep 17 00:00:00 2001 From: David Smith Date: Mon, 30 Aug 2010 16:53:46 -0500 Subject: [PATCH] Replaced obsolete index/rindex functions with strchr/strrchr. * runtime/staprun/common.c: Replaced index/rindex with strchr/strrchr. * runtime/staprun/staprun.c: Ditto. --- runtime/staprun/common.c | 8 ++++---- runtime/staprun/staprun.c | 11 ++++++----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/runtime/staprun/common.c b/runtime/staprun/common.c index 6a2ac77e6..d3550fb4d 100644 --- a/runtime/staprun/common.c +++ b/runtime/staprun/common.c @@ -15,7 +15,7 @@ #include #include #include - +#include /* variables needed by parse_args() */ int verbose; @@ -284,7 +284,7 @@ void usage(char *prog) */ void parse_modpath(const char *inpath) { - const char *mptr = rindex(inpath, '/'); + const char *mptr = strrchr(inpath, '/'); char *ptr; dbug(3, "inpath=%s\n", inpath); @@ -334,7 +334,7 @@ void parse_modpath(const char *inpath) dbug(2, "modpath=\"%s\"\n", modpath); - mptr = rindex(modpath, '/'); + mptr = strrchr(modpath, '/'); mptr++; } } else { @@ -355,7 +355,7 @@ void parse_modpath(const char *inpath) exit(1); } - ptr = rindex(modname, '.'); + ptr = strrchr(modname, '.'); if (ptr) *ptr = '\0'; diff --git a/runtime/staprun/staprun.c b/runtime/staprun/staprun.c index 5bd5163a0..57f25d2c4 100644 --- a/runtime/staprun/staprun.c +++ b/runtime/staprun/staprun.c @@ -21,6 +21,7 @@ */ #include "staprun.h" +#include #include #include @@ -426,24 +427,24 @@ void send_relocation_modules () Sample gl_pathv[]: /sys/modules/zlib_deflate/sections/.text Pieces: ^^^^^^^^^^^^ ^^^^^ */ - section_name = rindex (module_section_file, '/'); + section_name = strrchr (module_section_file, '/'); if (! section_name) continue; section_name ++; if (!strcmp (section_name, ".")) continue; if (!strcmp (section_name, "..")) continue; - module_name = index (module_section_file, '/'); + module_name = strchr (module_section_file, '/'); if (! module_name) continue; module_name ++; - module_name = index (module_name, '/'); + module_name = strchr (module_name, '/'); if (! module_name) continue; module_name ++; - module_name = index (module_name, '/'); + module_name = strchr (module_name, '/'); if (! module_name) continue; module_name ++; - module_name_end = index (module_name, '/'); + module_name_end = strchr (module_name, '/'); if (! module_name_end) continue; secfile = fopen (module_section_file, "r"); -- 2.43.5