Skip to content

Commit 7b43b69

Browse files
Ravi Bangoriaacmel
authored andcommitted
perf config: Introduce perf_config_u8()
Introduce perf_config_u8() utility function to convert char * input into u8 destination. We will utilize it in followup patch. Signed-off-by: Ravi Bangoria <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexey Budankov <[email protected]> Cc: Changbin Du <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Jin Yao <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Leo Yan <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Song Liu <[email protected]> Cc: Taeung Song <[email protected]> Cc: Thomas Richter <[email protected]> Cc: Yisheng Xie <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 46ccb44 commit 7b43b69

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

tools/perf/util/config.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,18 @@ int perf_config_int(int *dest, const char *name, const char *value)
374374
return 0;
375375
}
376376

377+
int perf_config_u8(u8 *dest, const char *name, const char *value)
378+
{
379+
long ret = 0;
380+
381+
if (!perf_parse_long(value, &ret)) {
382+
bad_config(name);
383+
return -1;
384+
}
385+
*dest = ret;
386+
return 0;
387+
}
388+
377389
static int perf_config_bool_or_int(const char *name, const char *value, int *is_bool)
378390
{
379391
int ret;

tools/perf/util/config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ typedef int (*config_fn_t)(const char *, const char *, void *);
2929
int perf_default_config(const char *, const char *, void *);
3030
int perf_config(config_fn_t fn, void *);
3131
int perf_config_int(int *dest, const char *, const char *);
32+
int perf_config_u8(u8 *dest, const char *name, const char *value);
3233
int perf_config_u64(u64 *dest, const char *, const char *);
3334
int perf_config_bool(const char *, const char *);
3435
int config_error_nonbool(const char *);

0 commit comments

Comments
 (0)