aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2012-11-10 17:41:15 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-11-14 14:50:38 -0500
commit61e945150fe0ec4c20b7a3663b90c7ab705a88b4 (patch)
tree159616762190a80410d18a2ae791bc8dfe35c525 /tools
parentf95e0818cbd026a8f2277895c65fcc9cc5b28cf6 (diff)
perf tools: Stop using 'self' in pstack
As suggested by tglx long ago. Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-zgcldbjno41jn02b15760k4p@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/pstack.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/tools/perf/util/pstack.c b/tools/perf/util/pstack.c
index 13d36faf64eb..daa17aeb6c63 100644
--- a/tools/perf/util/pstack.c
+++ b/tools/perf/util/pstack.c
@@ -17,59 +17,59 @@ struct pstack {
17 17
18struct pstack *pstack__new(unsigned short max_nr_entries) 18struct pstack *pstack__new(unsigned short max_nr_entries)
19{ 19{
20 struct pstack *self = zalloc((sizeof(*self) + 20 struct pstack *pstack = zalloc((sizeof(*pstack) +
21 max_nr_entries * sizeof(void *))); 21 max_nr_entries * sizeof(void *)));
22 if (self != NULL) 22 if (pstack != NULL)
23 self->max_nr_entries = max_nr_entries; 23 pstack->max_nr_entries = max_nr_entries;
24 return self; 24 return pstack;
25} 25}
26 26
27void pstack__delete(struct pstack *self) 27void pstack__delete(struct pstack *pstack)
28{ 28{
29 free(self); 29 free(pstack);
30} 30}
31 31
32bool pstack__empty(const struct pstack *self) 32bool pstack__empty(const struct pstack *pstack)
33{ 33{
34 return self->top == 0; 34 return pstack->top == 0;
35} 35}
36 36
37void pstack__remove(struct pstack *self, void *key) 37void pstack__remove(struct pstack *pstack, void *key)
38{ 38{
39 unsigned short i = self->top, last_index = self->top - 1; 39 unsigned short i = pstack->top, last_index = pstack->top - 1;
40 40
41 while (i-- != 0) { 41 while (i-- != 0) {
42 if (self->entries[i] == key) { 42 if (pstack->entries[i] == key) {
43 if (i < last_index) 43 if (i < last_index)
44 memmove(self->entries + i, 44 memmove(pstack->entries + i,
45 self->entries + i + 1, 45 pstack->entries + i + 1,
46 (last_index - i) * sizeof(void *)); 46 (last_index - i) * sizeof(void *));
47 --self->top; 47 --pstack->top;
48 return; 48 return;
49 } 49 }
50 } 50 }
51 pr_err("%s: %p not on the pstack!\n", __func__, key); 51 pr_err("%s: %p not on the pstack!\n", __func__, key);
52} 52}
53 53
54void pstack__push(struct pstack *self, void *key) 54void pstack__push(struct pstack *pstack, void *key)
55{ 55{
56 if (self->top == self->max_nr_entries) { 56 if (pstack->top == pstack->max_nr_entries) {
57 pr_err("%s: top=%d, overflow!\n", __func__, self->top); 57 pr_err("%s: top=%d, overflow!\n", __func__, pstack->top);
58 return; 58 return;
59 } 59 }
60 self->entries[self->top++] = key; 60 pstack->entries[pstack->top++] = key;
61} 61}
62 62
63void *pstack__pop(struct pstack *self) 63void *pstack__pop(struct pstack *pstack)
64{ 64{
65 void *ret; 65 void *ret;
66 66
67 if (self->top == 0) { 67 if (pstack->top == 0) {
68 pr_err("%s: underflow!\n", __func__); 68 pr_err("%s: underflow!\n", __func__);
69 return NULL; 69 return NULL;
70 } 70 }
71 71
72 ret = self->entries[--self->top]; 72 ret = pstack->entries[--pstack->top];
73 self->entries[self->top] = NULL; 73 pstack->entries[pstack->top] = NULL;
74 return ret; 74 return ret;
75} 75}