perf tools: Stop using 'self' in some more places
authorArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 22 Oct 2013 22:01:31 +0000 (19:01 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 23 Oct 2013 12:55:37 +0000 (09:55 -0300)
As suggested by tglx, 'self' should be replaced by something that is
more useful.

Cc: Adrian Hunter <adrian.hunter@intel.com>
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: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-fmblhc6tbb99tk1q8vowtsbj@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-annotate.c
tools/perf/builtin-diff.c
tools/perf/builtin-inject.c
tools/perf/builtin-report.c
tools/perf/util/build-id.c
tools/perf/util/hist.c
tools/perf/util/sort.c
tools/perf/util/strfilter.c
tools/perf/util/thread.c

index 03cfa592071f003e13ab0a541bf8d646c0df15c4..17c6b494e8cc896c6d5734d91f93e2185d67f2f7 100644 (file)
@@ -118,11 +118,11 @@ static int hist_entry__tty_annotate(struct hist_entry *he,
                                    ann->print_line, ann->full_paths, 0, 0);
 }
 
-static void hists__find_annotations(struct hists *self,
+static void hists__find_annotations(struct hists *hists,
                                    struct perf_evsel *evsel,
                                    struct perf_annotate *ann)
 {
-       struct rb_node *nd = rb_first(&self->entries), *next;
+       struct rb_node *nd = rb_first(&hists->entries), *next;
        int key = K_RIGHT;
 
        while (nd) {
index 419d27dd708b682ba1418dd59347a5955df649a9..9c828881714cc84c7b2dc7ca4f25e775b26bbe91 100644 (file)
@@ -303,12 +303,11 @@ static int formula_fprintf(struct hist_entry *he, struct hist_entry *pair,
        return -1;
 }
 
-static int hists__add_entry(struct hists *self,
+static int hists__add_entry(struct hists *hists,
                            struct addr_location *al, u64 period,
                            u64 weight, u64 transaction)
 {
-       if (__hists__add_entry(self, al, NULL, period, weight, transaction)
-           != NULL)
+       if (__hists__add_entry(hists, al, NULL, period, weight, transaction) != NULL)
                return 0;
        return -ENOMEM;
 }
index 4aa6d7850bcc1db8804571f10ee5625cbdd4b3d8..eb1a5941912b218b00553530b20dfc479175e730 100644 (file)
@@ -162,38 +162,38 @@ static int perf_event__repipe_tracing_data(struct perf_tool *tool,
        return err;
 }
 
-static int dso__read_build_id(struct dso *self)
+static int dso__read_build_id(struct dso *dso)
 {
-       if (self->has_build_id)
+       if (dso->has_build_id)
                return 0;
 
-       if (filename__read_build_id(self->long_name, self->build_id,
-                                   sizeof(self->build_id)) > 0) {
-               self->has_build_id = true;
+       if (filename__read_build_id(dso->long_name, dso->build_id,
+                                   sizeof(dso->build_id)) > 0) {
+               dso->has_build_id = true;
                return 0;
        }
 
        return -1;
 }
 
-static int dso__inject_build_id(struct dso *self, struct perf_tool *tool,
+static int dso__inject_build_id(struct dso *dso, struct perf_tool *tool,
                                struct machine *machine)
 {
        u16 misc = PERF_RECORD_MISC_USER;
        int err;
 
-       if (dso__read_build_id(self) < 0) {
-               pr_debug("no build_id found for %s\n", self->long_name);
+       if (dso__read_build_id(dso) < 0) {
+               pr_debug("no build_id found for %s\n", dso->long_name);
                return -1;
        }
 
-       if (self->kernel)
+       if (dso->kernel)
                misc = PERF_RECORD_MISC_KERNEL;
 
-       err = perf_event__synthesize_build_id(tool, self, misc, perf_event__repipe,
+       err = perf_event__synthesize_build_id(tool, dso, misc, perf_event__repipe,
                                              machine);
        if (err) {
-               pr_err("Can't synthesize build_id event for %s\n", self->long_name);
+               pr_err("Can't synthesize build_id event for %s\n", dso->long_name);
                return -1;
        }
 
index 81addcabb356800780320c71e7bd69af52b4f2b9..e3598a456017c2d205a83a59d8efd1844ba0c3d7 100644 (file)
@@ -373,9 +373,9 @@ static int process_read_event(struct perf_tool *tool,
 /* For pipe mode, sample_type is not currently set */
 static int perf_report__setup_sample_type(struct perf_report *rep)
 {
-       struct perf_session *self = rep->session;
-       u64 sample_type = perf_evlist__combined_sample_type(self->evlist);
-       bool is_pipe = perf_data_file__is_pipe(self->file);
+       struct perf_session *session = rep->session;
+       u64 sample_type = perf_evlist__combined_sample_type(session->evlist);
+       bool is_pipe = perf_data_file__is_pipe(session->file);
 
        if (!is_pipe && !(sample_type & PERF_SAMPLE_CALLCHAIN)) {
                if (sort__has_parent) {
@@ -417,14 +417,14 @@ static void sig_handler(int sig __maybe_unused)
 }
 
 static size_t hists__fprintf_nr_sample_events(struct perf_report *rep,
-                                             struct hists *self,
+                                             struct hists *hists,
                                              const char *evname, FILE *fp)
 {
        size_t ret;
        char unit;
-       unsigned long nr_samples = self->stats.nr_events[PERF_RECORD_SAMPLE];
-       u64 nr_events = self->stats.total_period;
-       struct perf_evsel *evsel = hists_to_evsel(self);
+       unsigned long nr_samples = hists->stats.nr_events[PERF_RECORD_SAMPLE];
+       u64 nr_events = hists->stats.total_period;
+       struct perf_evsel *evsel = hists_to_evsel(hists);
        char buf[512];
        size_t size = sizeof(buf);
 
index 7ded71d19d75323ab02184c460afde37fe17d831..a92770c98cc7c00dac6fdd57258eb120960a5294 100644 (file)
@@ -89,14 +89,14 @@ int build_id__sprintf(const u8 *build_id, int len, char *bf)
        return raw - build_id;
 }
 
-char *dso__build_id_filename(struct dso *self, char *bf, size_t size)
+char *dso__build_id_filename(struct dso *dso, char *bf, size_t size)
 {
        char build_id_hex[BUILD_ID_SIZE * 2 + 1];
 
-       if (!self->has_build_id)
+       if (!dso->has_build_id)
                return NULL;
 
-       build_id__sprintf(self->build_id, sizeof(self->build_id), build_id_hex);
+       build_id__sprintf(dso->build_id, sizeof(dso->build_id), build_id_hex);
        if (bf == NULL) {
                if (asprintf(&bf, "%s/.build-id/%.2s/%s", buildid_dir,
                             build_id_hex, build_id_hex + 2) < 0)
index cca03831f41abcc88557572220fa0d2e9b6a14c8..f0b863ef48969cc1149f404bf0f18802639215cf 100644 (file)
@@ -406,7 +406,7 @@ out:
        return he;
 }
 
-struct hist_entry *__hists__add_mem_entry(struct hists *self,
+struct hist_entry *__hists__add_mem_entry(struct hists *hists,
                                          struct addr_location *al,
                                          struct symbol *sym_parent,
                                          struct mem_info *mi,
@@ -429,14 +429,14 @@ struct hist_entry *__hists__add_mem_entry(struct hists *self,
                .level  = al->level,
                .parent = sym_parent,
                .filtered = symbol__parent_filter(sym_parent),
-               .hists = self,
+               .hists = hists,
                .mem_info = mi,
                .branch_info = NULL,
        };
-       return add_hist_entry(self, &entry, al, period, weight);
+       return add_hist_entry(hists, &entry, al, period, weight);
 }
 
-struct hist_entry *__hists__add_branch_entry(struct hists *self,
+struct hist_entry *__hists__add_branch_entry(struct hists *hists,
                                             struct addr_location *al,
                                             struct symbol *sym_parent,
                                             struct branch_info *bi,
@@ -460,14 +460,14 @@ struct hist_entry *__hists__add_branch_entry(struct hists *self,
                .parent = sym_parent,
                .filtered = symbol__parent_filter(sym_parent),
                .branch_info = bi,
-               .hists  = self,
+               .hists  = hists,
                .mem_info = NULL,
        };
 
-       return add_hist_entry(self, &entry, al, period, weight);
+       return add_hist_entry(hists, &entry, al, period, weight);
 }
 
-struct hist_entry *__hists__add_entry(struct hists *self,
+struct hist_entry *__hists__add_entry(struct hists *hists,
                                      struct addr_location *al,
                                      struct symbol *sym_parent, u64 period,
                                      u64 weight, u64 transaction)
@@ -488,13 +488,13 @@ struct hist_entry *__hists__add_entry(struct hists *self,
                },
                .parent = sym_parent,
                .filtered = symbol__parent_filter(sym_parent),
-               .hists  = self,
+               .hists  = hists,
                .branch_info = NULL,
                .mem_info = NULL,
                .transaction = transaction,
        };
 
-       return add_hist_entry(self, &entry, al, period, weight);
+       return add_hist_entry(hists, &entry, al, period, weight);
 }
 
 int64_t
index 1f9821db9e7719750d3d0d3304a42a262d3fda17..19b4aa279d1ee1d1257136bd67b3aa20e07beaf5 100644 (file)
@@ -60,11 +60,11 @@ sort__thread_cmp(struct hist_entry *left, struct hist_entry *right)
        return right->thread->tid - left->thread->tid;
 }
 
-static int hist_entry__thread_snprintf(struct hist_entry *self, char *bf,
+static int hist_entry__thread_snprintf(struct hist_entry *he, char *bf,
                                       size_t size, unsigned int width)
 {
        return repsep_snprintf(bf, size, "%*s:%5d", width - 6,
-                             self->thread->comm ?: "", self->thread->tid);
+                             he->thread->comm ?: "", he->thread->tid);
 }
 
 struct sort_entry sort_thread = {
@@ -94,10 +94,10 @@ sort__comm_collapse(struct hist_entry *left, struct hist_entry *right)
        return strcmp(comm_l, comm_r);
 }
 
-static int hist_entry__comm_snprintf(struct hist_entry *self, char *bf,
+static int hist_entry__comm_snprintf(struct hist_entry *he, char *bf,
                                     size_t size, unsigned int width)
 {
-       return repsep_snprintf(bf, size, "%*s", width, self->thread->comm);
+       return repsep_snprintf(bf, size, "%*s", width, he->thread->comm);
 }
 
 struct sort_entry sort_comm = {
@@ -148,10 +148,10 @@ static int _hist_entry__dso_snprintf(struct map *map, char *bf,
        return repsep_snprintf(bf, size, "%-*s", width, "[unknown]");
 }
 
-static int hist_entry__dso_snprintf(struct hist_entry *self, char *bf,
+static int hist_entry__dso_snprintf(struct hist_entry *he, char *bf,
                                    size_t size, unsigned int width)
 {
-       return _hist_entry__dso_snprintf(self->ms.map, bf, size, width);
+       return _hist_entry__dso_snprintf(he->ms.map, bf, size, width);
 }
 
 struct sort_entry sort_dso = {
@@ -234,11 +234,11 @@ static int _hist_entry__sym_snprintf(struct map *map, struct symbol *sym,
        return ret;
 }
 
-static int hist_entry__sym_snprintf(struct hist_entry *self, char *bf,
+static int hist_entry__sym_snprintf(struct hist_entry *he, char *bf,
                                    size_t size, unsigned int width)
 {
-       return _hist_entry__sym_snprintf(self->ms.map, self->ms.sym, self->ip,
-                                        self->level, bf, size, width);
+       return _hist_entry__sym_snprintf(he->ms.map, he->ms.sym, he->ip,
+                                        he->level, bf, size, width);
 }
 
 struct sort_entry sort_sym = {
@@ -274,11 +274,11 @@ sort__srcline_cmp(struct hist_entry *left, struct hist_entry *right)
        return strcmp(left->srcline, right->srcline);
 }
 
-static int hist_entry__srcline_snprintf(struct hist_entry *self, char *bf,
+static int hist_entry__srcline_snprintf(struct hist_entry *he, char *bf,
                                        size_t size,
                                        unsigned int width __maybe_unused)
 {
-       return repsep_snprintf(bf, size, "%s", self->srcline);
+       return repsep_snprintf(bf, size, "%s", he->srcline);
 }
 
 struct sort_entry sort_srcline = {
@@ -302,11 +302,11 @@ sort__parent_cmp(struct hist_entry *left, struct hist_entry *right)
        return strcmp(sym_l->name, sym_r->name);
 }
 
-static int hist_entry__parent_snprintf(struct hist_entry *self, char *bf,
+static int hist_entry__parent_snprintf(struct hist_entry *he, char *bf,
                                       size_t size, unsigned int width)
 {
        return repsep_snprintf(bf, size, "%-*s", width,
-                             self->parent ? self->parent->name : "[other]");
+                             he->parent ? he->parent->name : "[other]");
 }
 
 struct sort_entry sort_parent = {
@@ -324,10 +324,10 @@ sort__cpu_cmp(struct hist_entry *left, struct hist_entry *right)
        return right->cpu - left->cpu;
 }
 
-static int hist_entry__cpu_snprintf(struct hist_entry *self, char *bf,
-                                      size_t size, unsigned int width)
+static int hist_entry__cpu_snprintf(struct hist_entry *he, char *bf,
+                                   size_t size, unsigned int width)
 {
-       return repsep_snprintf(bf, size, "%*d", width, self->cpu);
+       return repsep_snprintf(bf, size, "%*d", width, he->cpu);
 }
 
 struct sort_entry sort_cpu = {
@@ -346,10 +346,10 @@ sort__dso_from_cmp(struct hist_entry *left, struct hist_entry *right)
                              right->branch_info->from.map);
 }
 
-static int hist_entry__dso_from_snprintf(struct hist_entry *self, char *bf,
+static int hist_entry__dso_from_snprintf(struct hist_entry *he, char *bf,
                                    size_t size, unsigned int width)
 {
-       return _hist_entry__dso_snprintf(self->branch_info->from.map,
+       return _hist_entry__dso_snprintf(he->branch_info->from.map,
                                         bf, size, width);
 }
 
@@ -360,10 +360,10 @@ sort__dso_to_cmp(struct hist_entry *left, struct hist_entry *right)
                              right->branch_info->to.map);
 }
 
-static int hist_entry__dso_to_snprintf(struct hist_entry *self, char *bf,
+static int hist_entry__dso_to_snprintf(struct hist_entry *he, char *bf,
                                       size_t size, unsigned int width)
 {
-       return _hist_entry__dso_snprintf(self->branch_info->to.map,
+       return _hist_entry__dso_snprintf(he->branch_info->to.map,
                                         bf, size, width);
 }
 
@@ -391,21 +391,21 @@ sort__sym_to_cmp(struct hist_entry *left, struct hist_entry *right)
        return _sort__sym_cmp(to_l->sym, to_r->sym);
 }
 
-static int hist_entry__sym_from_snprintf(struct hist_entry *self, char *bf,
+static int hist_entry__sym_from_snprintf(struct hist_entry *he, char *bf,
                                         size_t size, unsigned int width)
 {
-       struct addr_map_symbol *from = &self->branch_info->from;
+       struct addr_map_symbol *from = &he->branch_info->from;
        return _hist_entry__sym_snprintf(from->map, from->sym, from->addr,
-                                        self->level, bf, size, width);
+                                        he->level, bf, size, width);
 
 }
 
-static int hist_entry__sym_to_snprintf(struct hist_entry *self, char *bf,
+static int hist_entry__sym_to_snprintf(struct hist_entry *he, char *bf,
                                       size_t size, unsigned int width)
 {
-       struct addr_map_symbol *to = &self->branch_info->to;
+       struct addr_map_symbol *to = &he->branch_info->to;
        return _hist_entry__sym_snprintf(to->map, to->sym, to->addr,
-                                        self->level, bf, size, width);
+                                        he->level, bf, size, width);
 
 }
 
@@ -448,13 +448,13 @@ sort__mispredict_cmp(struct hist_entry *left, struct hist_entry *right)
        return mp || p;
 }
 
-static int hist_entry__mispredict_snprintf(struct hist_entry *self, char *bf,
+static int hist_entry__mispredict_snprintf(struct hist_entry *he, char *bf,
                                    size_t size, unsigned int width){
        static const char *out = "N/A";
 
-       if (self->branch_info->flags.predicted)
+       if (he->branch_info->flags.predicted)
                out = "N";
-       else if (self->branch_info->flags.mispred)
+       else if (he->branch_info->flags.mispred)
                out = "Y";
 
        return repsep_snprintf(bf, size, "%-*s", width, out);
@@ -474,19 +474,19 @@ sort__daddr_cmp(struct hist_entry *left, struct hist_entry *right)
        return (int64_t)(r - l);
 }
 
-static int hist_entry__daddr_snprintf(struct hist_entry *self, char *bf,
+static int hist_entry__daddr_snprintf(struct hist_entry *he, char *bf,
                                    size_t size, unsigned int width)
 {
        uint64_t addr = 0;
        struct map *map = NULL;
        struct symbol *sym = NULL;
 
-       if (self->mem_info) {
-               addr = self->mem_info->daddr.addr;
-               map = self->mem_info->daddr.map;
-               sym = self->mem_info->daddr.sym;
+       if (he->mem_info) {
+               addr = he->mem_info->daddr.addr;
+               map = he->mem_info->daddr.map;
+               sym = he->mem_info->daddr.sym;
        }
-       return _hist_entry__sym_snprintf(map, sym, addr, self->level, bf, size,
+       return _hist_entry__sym_snprintf(map, sym, addr, he->level, bf, size,
                                         width);
 }
 
@@ -504,13 +504,13 @@ sort__dso_daddr_cmp(struct hist_entry *left, struct hist_entry *right)
        return _sort__dso_cmp(map_l, map_r);
 }
 
-static int hist_entry__dso_daddr_snprintf(struct hist_entry *self, char *bf,
+static int hist_entry__dso_daddr_snprintf(struct hist_entry *he, char *bf,
                                    size_t size, unsigned int width)
 {
        struct map *map = NULL;
 
-       if (self->mem_info)
-               map = self->mem_info->daddr.map;
+       if (he->mem_info)
+               map = he->mem_info->daddr.map;
 
        return _hist_entry__dso_snprintf(map, bf, size, width);
 }
@@ -534,14 +534,14 @@ sort__locked_cmp(struct hist_entry *left, struct hist_entry *right)
        return (int64_t)(data_src_r.mem_lock - data_src_l.mem_lock);
 }
 
-static int hist_entry__locked_snprintf(struct hist_entry *self, char *bf,
+static int hist_entry__locked_snprintf(struct hist_entry *he, char *bf,
                                    size_t size, unsigned int width)
 {
        const char *out;
        u64 mask = PERF_MEM_LOCK_NA;
 
-       if (self->mem_info)
-               mask = self->mem_info->data_src.mem_lock;
+       if (he->mem_info)
+               mask = he->mem_info->data_src.mem_lock;
 
        if (mask & PERF_MEM_LOCK_NA)
                out = "N/A";
@@ -583,7 +583,7 @@ static const char * const tlb_access[] = {
 };
 #define NUM_TLB_ACCESS (sizeof(tlb_access)/sizeof(const char *))
 
-static int hist_entry__tlb_snprintf(struct hist_entry *self, char *bf,
+static int hist_entry__tlb_snprintf(struct hist_entry *he, char *bf,
                                    size_t size, unsigned int width)
 {
        char out[64];
@@ -594,8 +594,8 @@ static int hist_entry__tlb_snprintf(struct hist_entry *self, char *bf,
 
        out[0] = '\0';
 
-       if (self->mem_info)
-               m = self->mem_info->data_src.mem_dtlb;
+       if (he->mem_info)
+               m = he->mem_info->data_src.mem_dtlb;
 
        hit = m & PERF_MEM_TLB_HIT;
        miss = m & PERF_MEM_TLB_MISS;
@@ -660,7 +660,7 @@ static const char * const mem_lvl[] = {
 };
 #define NUM_MEM_LVL (sizeof(mem_lvl)/sizeof(const char *))
 
-static int hist_entry__lvl_snprintf(struct hist_entry *self, char *bf,
+static int hist_entry__lvl_snprintf(struct hist_entry *he, char *bf,
                                    size_t size, unsigned int width)
 {
        char out[64];
@@ -669,8 +669,8 @@ static int hist_entry__lvl_snprintf(struct hist_entry *self, char *bf,
        u64 m =  PERF_MEM_LVL_NA;
        u64 hit, miss;
 
-       if (self->mem_info)
-               m  = self->mem_info->data_src.mem_lvl;
+       if (he->mem_info)
+               m  = he->mem_info->data_src.mem_lvl;
 
        out[0] = '\0';
 
@@ -728,7 +728,7 @@ static const char * const snoop_access[] = {
 };
 #define NUM_SNOOP_ACCESS (sizeof(snoop_access)/sizeof(const char *))
 
-static int hist_entry__snoop_snprintf(struct hist_entry *self, char *bf,
+static int hist_entry__snoop_snprintf(struct hist_entry *he, char *bf,
                                    size_t size, unsigned int width)
 {
        char out[64];
@@ -738,8 +738,8 @@ static int hist_entry__snoop_snprintf(struct hist_entry *self, char *bf,
 
        out[0] = '\0';
 
-       if (self->mem_info)
-               m = self->mem_info->data_src.mem_snoop;
+       if (he->mem_info)
+               m = he->mem_info->data_src.mem_snoop;
 
        for (i = 0; m && i < NUM_SNOOP_ACCESS; i++, m >>= 1) {
                if (!(m & 0x1))
@@ -776,10 +776,10 @@ sort__local_weight_cmp(struct hist_entry *left, struct hist_entry *right)
        return he_weight(left) - he_weight(right);
 }
 
-static int hist_entry__local_weight_snprintf(struct hist_entry *self, char *bf,
+static int hist_entry__local_weight_snprintf(struct hist_entry *he, char *bf,
                                    size_t size, unsigned int width)
 {
-       return repsep_snprintf(bf, size, "%-*llu", width, he_weight(self));
+       return repsep_snprintf(bf, size, "%-*llu", width, he_weight(he));
 }
 
 struct sort_entry sort_local_weight = {
@@ -795,10 +795,10 @@ sort__global_weight_cmp(struct hist_entry *left, struct hist_entry *right)
        return left->stat.weight - right->stat.weight;
 }
 
-static int hist_entry__global_weight_snprintf(struct hist_entry *self, char *bf,
+static int hist_entry__global_weight_snprintf(struct hist_entry *he, char *bf,
                                              size_t size, unsigned int width)
 {
-       return repsep_snprintf(bf, size, "%-*llu", width, self->stat.weight);
+       return repsep_snprintf(bf, size, "%-*llu", width, he->stat.weight);
 }
 
 struct sort_entry sort_global_weight = {
@@ -857,12 +857,12 @@ sort__abort_cmp(struct hist_entry *left, struct hist_entry *right)
                right->branch_info->flags.abort;
 }
 
-static int hist_entry__abort_snprintf(struct hist_entry *self, char *bf,
+static int hist_entry__abort_snprintf(struct hist_entry *he, char *bf,
                                    size_t size, unsigned int width)
 {
        static const char *out = ".";
 
-       if (self->branch_info->flags.abort)
+       if (he->branch_info->flags.abort)
                out = "A";
        return repsep_snprintf(bf, size, "%-*s", width, out);
 }
@@ -881,12 +881,12 @@ sort__in_tx_cmp(struct hist_entry *left, struct hist_entry *right)
                right->branch_info->flags.in_tx;
 }
 
-static int hist_entry__in_tx_snprintf(struct hist_entry *self, char *bf,
+static int hist_entry__in_tx_snprintf(struct hist_entry *he, char *bf,
                                    size_t size, unsigned int width)
 {
        static const char *out = ".";
 
-       if (self->branch_info->flags.in_tx)
+       if (he->branch_info->flags.in_tx)
                out = "T";
 
        return repsep_snprintf(bf, size, "%-*s", width, out);
@@ -940,10 +940,10 @@ int hist_entry__transaction_len(void)
        return len;
 }
 
-static int hist_entry__transaction_snprintf(struct hist_entry *self, char *bf,
+static int hist_entry__transaction_snprintf(struct hist_entry *he, char *bf,
                                            size_t size, unsigned int width)
 {
-       u64 t = self->transaction;
+       u64 t = he->transaction;
        char buf[128];
        char *p = buf;
        int i;
@@ -1125,7 +1125,7 @@ int setup_sorting(void)
        return ret;
 }
 
-static void sort_entry__setup_elide(struct sort_entry *self,
+static void sort_entry__setup_elide(struct sort_entry *se,
                                    struct strlist *list,
                                    const char *list_name, FILE *fp)
 {
@@ -1133,7 +1133,7 @@ static void sort_entry__setup_elide(struct sort_entry *self,
                if (fp != NULL)
                        fprintf(fp, "# %s: %s\n", list_name,
                                strlist__entry(list, 0)->s);
-               self->elide = true;
+               se->elide = true;
        }
 }
 
index 834c8ebfe38e961169e07eb8d89bf17ffe42782c..67e4a0082822837cc3f46840b929ac9d6aaa6255 100644 (file)
@@ -10,22 +10,22 @@ static const char *OP_not   = "!";  /* Logical NOT */
 #define is_operator(c) ((c) == '|' || (c) == '&' || (c) == '!')
 #define is_separator(c)        (is_operator(c) || (c) == '(' || (c) == ')')
 
-static void strfilter_node__delete(struct strfilter_node *self)
+static void strfilter_node__delete(struct strfilter_node *node)
 {
-       if (self) {
-               if (self->p && !is_operator(*self->p))
-                       free((char *)self->p);
-               strfilter_node__delete(self->l);
-               strfilter_node__delete(self->r);
-               free(self);
+       if (node) {
+               if (node->p && !is_operator(*node->p))
+                       free((char *)node->p);
+               strfilter_node__delete(node->l);
+               strfilter_node__delete(node->r);
+               free(node);
        }
 }
 
-void strfilter__delete(struct strfilter *self)
+void strfilter__delete(struct strfilter *filter)
 {
-       if (self) {
-               strfilter_node__delete(self->root);
-               free(self);
+       if (filter) {
+               strfilter_node__delete(filter->root);
+               free(filter);
        }
 }
 
@@ -170,30 +170,30 @@ struct strfilter *strfilter__new(const char *rules, const char **err)
        return ret;
 }
 
-static bool strfilter_node__compare(struct strfilter_node *self,
+static bool strfilter_node__compare(struct strfilter_node *node,
                                    const char *str)
 {
-       if (!self || !self->p)
+       if (!node || !node->p)
                return false;
 
-       switch (*self->p) {
+       switch (*node->p) {
        case '|':       /* OR */
-               return strfilter_node__compare(self->l, str) ||
-                       strfilter_node__compare(self->r, str);
+               return strfilter_node__compare(node->l, str) ||
+                       strfilter_node__compare(node->r, str);
        case '&':       /* AND */
-               return strfilter_node__compare(self->l, str) &&
-                       strfilter_node__compare(self->r, str);
+               return strfilter_node__compare(node->l, str) &&
+                       strfilter_node__compare(node->r, str);
        case '!':       /* NOT */
-               return !strfilter_node__compare(self->r, str);
+               return !strfilter_node__compare(node->r, str);
        default:
-               return strglobmatch(str, self->p);
+               return strglobmatch(str, node->p);
        }
 }
 
 /* Return true if STR matches the filter rules */
-bool strfilter__compare(struct strfilter *self, const char *str)
+bool strfilter__compare(struct strfilter *node, const char *str)
 {
-       if (!self)
+       if (!node)
                return false;
-       return strfilter_node__compare(self->root, str);
+       return strfilter_node__compare(node->root, str);
 }
index e3d4a550a703211d8fabeb9807c28a86466fe6d8..80d19a0860721b60dbcf57578261537ebd5f7af5 100644 (file)
@@ -9,51 +9,51 @@
 
 struct thread *thread__new(pid_t pid, pid_t tid)
 {
-       struct thread *self = zalloc(sizeof(*self));
+       struct thread *thread = zalloc(sizeof(*thread));
 
-       if (self != NULL) {
-               map_groups__init(&self->mg);
-               self->pid_ = pid;
-               self->tid = tid;
-               self->ppid = -1;
-               self->comm = malloc(32);
-               if (self->comm)
-                       snprintf(self->comm, 32, ":%d", self->tid);
+       if (thread != NULL) {
+               map_groups__init(&thread->mg);
+               thread->pid_ = pid;
+               thread->tid = tid;
+               thread->ppid = -1;
+               thread->comm = malloc(32);
+               if (thread->comm)
+                       snprintf(thread->comm, 32, ":%d", thread->tid);
        }
 
-       return self;
+       return thread;
 }
 
-void thread__delete(struct thread *self)
+void thread__delete(struct thread *thread)
 {
-       map_groups__exit(&self->mg);
-       free(self->comm);
-       free(self);
+       map_groups__exit(&thread->mg);
+       free(thread->comm);
+       free(thread);
 }
 
-int thread__set_comm(struct thread *self, const char *comm)
+int thread__set_comm(struct thread *thread, const char *comm)
 {
        int err;
 
-       if (self->comm)
-               free(self->comm);
-       self->comm = strdup(comm);
-       err = self->comm == NULL ? -ENOMEM : 0;
+       if (thread->comm)
+               free(thread->comm);
+       thread->comm = strdup(comm);
+       err = thread->comm == NULL ? -ENOMEM : 0;
        if (!err) {
-               self->comm_set = true;
+               thread->comm_set = true;
        }
        return err;
 }
 
-int thread__comm_len(struct thread *self)
+int thread__comm_len(struct thread *thread)
 {
-       if (!self->comm_len) {
-               if (!self->comm)
+       if (!thread->comm_len) {
+               if (!thread->comm)
                        return 0;
-               self->comm_len = strlen(self->comm);
+               thread->comm_len = strlen(thread->comm);
        }
 
-       return self->comm_len;
+       return thread->comm_len;
 }
 
 size_t thread__fprintf(struct thread *thread, FILE *fp)
@@ -62,30 +62,30 @@ size_t thread__fprintf(struct thread *thread, FILE *fp)
               map_groups__fprintf(&thread->mg, verbose, fp);
 }
 
-void thread__insert_map(struct thread *self, struct map *map)
+void thread__insert_map(struct thread *thread, struct map *map)
 {
-       map_groups__fixup_overlappings(&self->mg, map, verbose, stderr);
-       map_groups__insert(&self->mg, map);
+       map_groups__fixup_overlappings(&thread->mg, map, verbose, stderr);
+       map_groups__insert(&thread->mg, map);
 }
 
-int thread__fork(struct thread *self, struct thread *parent)
+int thread__fork(struct thread *thread, struct thread *parent)
 {
        int i;
 
        if (parent->comm_set) {
-               if (self->comm)
-                       free(self->comm);
-               self->comm = strdup(parent->comm);
-               if (!self->comm)
+               if (thread->comm)
+                       free(thread->comm);
+               thread->comm = strdup(parent->comm);
+               if (!thread->comm)
                        return -ENOMEM;
-               self->comm_set = true;
+               thread->comm_set = true;
        }
 
        for (i = 0; i < MAP__NR_TYPES; ++i)
-               if (map_groups__clone(&self->mg, &parent->mg, i) < 0)
+               if (map_groups__clone(&thread->mg, &parent->mg, i) < 0)
                        return -ENOMEM;
 
-       self->ppid = parent->tid;
+       thread->ppid = parent->tid;
 
        return 0;
 }