From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>, Thomas Gleixner <tglx@linutronix.de>
Cc: Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
Clark Williams <williams@redhat.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Adrian Hunter <adrian.hunter@intel.com>
Subject: [PATCH 33/43] perf tools: Remove trim() implementation, use tools/lib's strim()
Date: Mon, 1 Jul 2019 23:26:06 -0300 [thread overview]
Message-ID: <20190702022616.1259-34-acme@kernel.org> (raw)
In-Reply-To: <20190702022616.1259-1-acme@kernel.org>
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Moving more stuff out of tools/perf/util/ and using the kernel idiom.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/n/tip-wpj8rktj62yse5dq6ckny6de@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/tests/builtin-test.c | 3 ++-
tools/perf/ui/browsers/hists.c | 3 ++-
tools/perf/ui/gtk/hists.c | 5 +++--
tools/perf/ui/stdio/hist.c | 2 +-
tools/perf/util/string2.h | 5 -----
5 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index cd72ff0f7658..66a82badc1d1 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -22,6 +22,7 @@
#include "string2.h"
#include "symbol.h"
#include <linux/kernel.h>
+#include <linux/string.h>
#include <subcmd/exec-cmd.h>
static bool dont_fork;
@@ -438,7 +439,7 @@ static const char *shell_test__description(char *description, size_t size,
description = fgets(description, size, fp);
fclose(fp);
- return description ? trim(description + 1) : NULL;
+ return description ? strim(description + 1) : NULL;
}
#define for_each_shell_test(dir, base, ent) \
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 04a56114df92..10243408f3dc 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -6,6 +6,7 @@
#include <stdlib.h>
#include <string.h>
#include <linux/rbtree.h>
+#include <linux/string.h>
#include <sys/ttydefaults.h>
#include <linux/time64.h>
@@ -1686,7 +1687,7 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows
ret = fmt->header(fmt, &dummy_hpp, hists, 0, NULL);
dummy_hpp.buf[ret] = '\0';
- start = trim(dummy_hpp.buf);
+ start = strim(dummy_hpp.buf);
ret = strlen(start);
if (start != dummy_hpp.buf)
diff --git a/tools/perf/ui/gtk/hists.c b/tools/perf/ui/gtk/hists.c
index 6341c421a8f7..3955ed1d1bd9 100644
--- a/tools/perf/ui/gtk/hists.c
+++ b/tools/perf/ui/gtk/hists.c
@@ -9,6 +9,7 @@
#include "../string2.h"
#include "gtk.h"
#include <signal.h>
+#include <linux/string.h>
#define MAX_COLUMNS 32
@@ -459,7 +460,7 @@ static void perf_gtk__add_hierarchy_entries(struct hists *hists,
advance_hpp(hpp, ret + 2);
}
- gtk_tree_store_set(store, &iter, col_idx, trim(bf), -1);
+ gtk_tree_store_set(store, &iter, col_idx, strim(bf), -1);
if (!he->leaf) {
hpp->buf = bf;
@@ -555,7 +556,7 @@ static void perf_gtk__show_hierarchy(GtkWidget *window, struct hists *hists,
first_col = false;
fmt->header(fmt, &hpp, hists, 0, NULL);
- strcat(buf, trim(hpp.buf));
+ strcat(buf, strim(hpp.buf));
}
}
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index 594e56628904..9eb0131c3ade 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -620,7 +620,7 @@ static int hists__fprintf_hierarchy_headers(struct hists *hists,
fmt->header(fmt, hpp, hists, 0, NULL);
- header_width += fprintf(fp, "%s", trim(hpp->buf));
+ header_width += fprintf(fp, "%s", strim(hpp->buf));
}
}
diff --git a/tools/perf/util/string2.h b/tools/perf/util/string2.h
index db02059e31c5..5bc3fea52cdc 100644
--- a/tools/perf/util/string2.h
+++ b/tools/perf/util/string2.h
@@ -25,11 +25,6 @@ char *strxfrchar(char *s, char from, char to);
char *rtrim(char *s);
-static inline char *trim(char *s)
-{
- return skip_spaces(rtrim(s));
-}
-
char *asprintf_expr_inout_ints(const char *var, bool in, size_t nints, int *ints);
static inline char *asprintf_expr_in_ints(const char *var, size_t nints, int *ints)
--
2.20.1
next prev parent reply other threads:[~2019-07-02 2:28 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-02 2:25 [GIT PULL] perf/core improvements and fixes Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 01/43] perf tools: Fix cache.h include directive Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 02/43] perf thread-stack: Fix thread stack return from kernel for kernel-only case Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 03/43] perf thread-stack: Eliminate code duplicating thread_stack__pop_ks() Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 04/43] perf tools: Increase MAX_NR_CPUS and MAX_CACHES Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 05/43] perf intel-pt: Decoder to output CBR changes immediately Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 06/43] perf intel-pt: Cater for CBR change in PSB+ Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 07/43] perf intel-pt: Add CBR value to decoder state Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 08/43] perf intel-pt: Synthesize CBR events when last seen value changes Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 09/43] perf db-export: Export synth events Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 10/43] perf scripts python: export-to-sqlite.py: Export Intel PT power and ptwrite events Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 11/43] perf scripts python: export-to-postgresql.py: " Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 12/43] perf ctype: Remove unused 'graph_line' variable Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 13/43] perf ui stdio: No need to use 'spaces' to left align Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 14/43] perf ctype: Remove now unused 'spaces' variable Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 15/43] perf string: Move 'dots' and 'graph_dotted_line' out of sane_ctype.h Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 16/43] tools x86 machine: Add missing util.h to pick up 'page_size' Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 17/43] perf kallsyms: Adopt hex2u64 from tools/perf/util/util.h Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 18/43] perf symbols: We need util.h in symbol-elf.c for zfree() Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 19/43] perf tools: Remove old baggage that is util/include/linux/ctype.h Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 20/43] perf tools: Add missing util.h to pick up 'page_size' variable Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 21/43] tools perf: Move from sane_ctype.h obtained from git to the Linux's original Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 22/43] perf tools: Use linux/ctype.h in more places Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 23/43] tools lib: Adopt skip_spaces() from the kernel sources Arnaldo Carvalho de Melo
2019-07-02 12:12 ` Jiri Olsa
2019-07-02 13:46 ` Arnaldo Carvalho de Melo
2019-07-02 13:48 ` Arnaldo Carvalho de Melo
2019-07-02 13:54 ` Jiri Olsa
2019-07-02 14:02 ` Arnaldo Carvalho de Melo
2019-07-02 13:49 ` Joe Perches
2019-07-03 14:32 ` [tip:perf/core] objtool: Fix build by linking against tools/lib/ctype.o sources tip-bot for Jiri Olsa
2019-07-02 2:25 ` [PATCH 24/43] perf stat: Use recently introduced skip_spaces() Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 25/43] perf header: Use skip_spaces() in __write_cpudesc() Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 26/43] perf time-utils: Use skip_spaces() Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 27/43] perf probe: Use skip_spaces() for argv handling Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 28/43] perf strfilter: Use skip_spaces() Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 29/43] perf metricgroup: Use strsep() Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 30/43] perf report: Use skip_spaces() Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 31/43] perf tools: Ditch rtrim(), use skip_spaces() to get closer to the kernel Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 32/43] tools lib: Adopt strim() from " Arnaldo Carvalho de Melo
[not found] ` <CAGje9yTfFrUxj-vSX=Au856Fe_307aQqD=YrbGeWfHESQ6Rw8w@mail.gmail.com>
2019-07-02 16:00 ` Arnaldo Carvalho de Melo
2019-07-02 2:26 ` Arnaldo Carvalho de Melo [this message]
2019-07-02 2:26 ` [PATCH 34/43] perf tools: Ditch rtrim(), use strim() from tools/lib Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 35/43] tools lib: Adopt strreplace() from the kernel Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 36/43] perf tools: Drop strxfrchar(), use strreplace() equivalent from kernel Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 37/43] tools lib: Move argv_{split,free} from tools/perf/util/ Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 38/43] perf stat: Make metric event lookup more robust Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 39/43] perf stat: Don't merge events in the same PMU Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 40/43] perf stat: Fix group lookup for metric group Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 41/43] perf stat: Fix metrics with --no-merge Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 42/43] perf annotate: Add csky support Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 43/43] perf jevents: Use nonlocal include statements in pmu-events.c Arnaldo Carvalho de Melo
2019-07-03 13:55 ` [GIT PULL] perf/core improvements and fixes Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190702022616.1259-34-acme@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=tglx@linutronix.de \
--cc=williams@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).