lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tip-oyi6zif3810nwi4uu85odnhv@git.kernel.org>
Date:   Wed, 3 Jul 2019 07:26:20 -0700
From:   tip-bot for Arnaldo Carvalho de Melo <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     acme@...hat.com, adrian.hunter@...el.com, namhyung@...nel.org,
        linux-kernel@...r.kernel.org, mingo@...nel.org, jolsa@...nel.org,
        hpa@...or.com, tglx@...utronix.de
Subject: [tip:perf/core] perf tools: Drop strxfrchar(), use strreplace()
 equivalent from kernel

Commit-ID:  af0de0c5f060b1d4eae6033043eb9eafd15aa738
Gitweb:     https://git.kernel.org/tip/af0de0c5f060b1d4eae6033043eb9eafd15aa738
Author:     Arnaldo Carvalho de Melo <acme@...hat.com>
AuthorDate: Wed, 26 Jun 2019 12:45:09 -0300
Committer:  Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Mon, 1 Jul 2019 22:50:40 -0300

perf tools: Drop strxfrchar(), use strreplace() equivalent from kernel

No change in behaviour intended, just reducing the codebase and using
something available in tools/lib/.

Cc: Adrian Hunter <adrian.hunter@...el.com>
Cc: Jiri Olsa <jolsa@...nel.org>
Cc: Namhyung Kim <namhyung@...nel.org>
Link: https://lkml.kernel.org/n/tip-oyi6zif3810nwi4uu85odnhv@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
 tools/perf/util/dso.c     |  3 ++-
 tools/perf/util/string.c  | 18 ------------------
 tools/perf/util/string2.h |  1 -
 3 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index 1fb18292c2d3..c7fde04400f7 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <asm/bug.h>
 #include <linux/kernel.h>
+#include <linux/string.h>
 #include <sys/time.h>
 #include <sys/resource.h>
 #include <sys/types.h>
@@ -394,7 +395,7 @@ int __kmod_path__parse(struct kmod_path *m, const char *path,
 				return -ENOMEM;
 		}
 
-		strxfrchar(m->name, '-', '_');
+		strreplace(m->name, '-', '_');
 	}
 
 	return 0;
diff --git a/tools/perf/util/string.c b/tools/perf/util/string.c
index 93a5340424df..9b7fbb0cbecd 100644
--- a/tools/perf/util/string.c
+++ b/tools/perf/util/string.c
@@ -300,24 +300,6 @@ int strtailcmp(const char *s1, const char *s2)
 	return 0;
 }
 
-/**
- * strxfrchar - Locate and replace character in @s
- * @s:    The string to be searched/changed.
- * @from: Source character to be replaced.
- * @to:   Destination character.
- *
- * Return pointer to the changed string.
- */
-char *strxfrchar(char *s, char from, char to)
-{
-	char *p = s;
-
-	while ((p = strchr(p, from)) != NULL)
-		*p++ = to;
-
-	return s;
-}
-
 char *asprintf_expr_inout_ints(const char *var, bool in, size_t nints, int *ints)
 {
 	/*
diff --git a/tools/perf/util/string2.h b/tools/perf/util/string2.h
index 6da835ad8f5b..2696c3fcd780 100644
--- a/tools/perf/util/string2.h
+++ b/tools/perf/util/string2.h
@@ -21,7 +21,6 @@ static inline bool strisglob(const char *str)
 	return strpbrk(str, "*?[") != NULL;
 }
 int strtailcmp(const char *s1, const char *s2);
-char *strxfrchar(char *s, char from, char to);
 
 char *asprintf_expr_inout_ints(const char *var, bool in, size_t nints, int *ints);
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ