Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 338917
b: refs/heads/master
c: ea36c46
h: refs/heads/master
i:
  338915: eac2053
v: v3
  • Loading branch information
Jiri Olsa authored and Arnaldo Carvalho de Melo committed Oct 29, 2012
1 parent 7fcdd65 commit d77a214
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b2aff5f615793fa4c1313d82635b83cd7de8d9fd
refs/heads/master: ea36c46be69c6e49c877971c4b3b3876b24b6082
18 changes: 18 additions & 0 deletions trunk/tools/perf/util/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,24 @@ 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;
}

/**
* rtrim - Removes trailing whitespace from @s.
* @s: The string to be stripped.
Expand Down
10 changes: 0 additions & 10 deletions trunk/tools/perf/util/symbol.c
Original file line number Diff line number Diff line change
Expand Up @@ -2050,16 +2050,6 @@ int machines__create_kernel_maps(struct rb_root *machines, pid_t pid)
return machine__create_kernel_maps(machine);
}

char *strxfrchar(char *s, char from, char to)
{
char *p = s;

while ((p = strchr(p, from)) != NULL)
*p++ = to;

return s;
}

int machines__create_guest_kernel_maps(struct rb_root *machines)
{
int ret = 0;
Expand Down
2 changes: 0 additions & 2 deletions trunk/tools/perf/util/symbol.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ static inline char *bfd_demangle(void __maybe_unused *v,
#endif
#endif

char *strxfrchar(char *s, char from, char to);

/*
* libelf 0.8.x and earlier do not support ELF_C_READ_MMAP;
* for newer versions we can use mmap to reduce memory usage:
Expand Down
1 change: 1 addition & 0 deletions trunk/tools/perf/util/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ void argv_free(char **argv);
bool strglobmatch(const char *str, const char *pat);
bool strlazymatch(const char *str, const char *pat);
int strtailcmp(const char *s1, const char *s2);
char *strxfrchar(char *s, char from, char to);
unsigned long convert_unit(unsigned long value, char *unit);
int readn(int fd, void *buf, size_t size);

Expand Down

0 comments on commit d77a214

Please sign in to comment.