summaryrefslogtreecommitdiffstats
path: root/elaborate.cxx
diff options
context:
space:
mode:
authorStan Cox <scox@redhat.com>2008-09-02 15:52:07 -0400
committerStan Cox <scox@redhat.com>2008-09-02 15:52:07 -0400
commitdb48cbe97f1de60f11dbb4ecc5f91c1023c24ef7 (patch)
tree0a63f93e4771f8e44c8cddcfe2b46382ee97035e /elaborate.cxx
parent3568f1ddb8d66de4f377412b7b3843607dcbfc4b (diff)
downloadsystemtap-steved-db48cbe97f1de60f11dbb4ecc5f91c1023c24ef7.tar.gz
systemtap-steved-db48cbe97f1de60f11dbb4ecc5f91c1023c24ef7.tar.xz
systemtap-steved-db48cbe97f1de60f11dbb4ecc5f91c1023c24ef7.zip
Simplify add_global_var_display token use.
Diffstat (limited to 'elaborate.cxx')
-rw-r--r--elaborate.cxx33
1 files changed, 10 insertions, 23 deletions
diff --git a/elaborate.cxx b/elaborate.cxx
index cfbe1392..44b6e24f 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -1172,10 +1172,7 @@ void add_global_var_display (systemtap_session& s)
block *b = new block;
pl->components.push_back (c);
- token* p_tok = new token;
- p_tok->type = tok_identifier;
- p_tok->content = "probe";
- p->tok = p_tok;
+ p->tok = l->tok;
p->locations.push_back (pl);
print_tok->type = tok_identifier;
print_tok->content = "printf";
@@ -1211,13 +1208,9 @@ void add_global_var_display (systemtap_session& s)
else // Array
{
int idx_count = l->index_types.size();
- token* idx_tok[idx_count];
symbol* idx_sym[idx_count];
vardecl* idx_v[idx_count];
// Create a foreach loop
- token* fe_tok = new token;
- fe_tok->type = tok_identifier;
- fe_tok->content = "foreach";
foreach_loop* fe = new foreach_loop;
fe->sort_direction = 0;
fe->limit = NULL;
@@ -1225,19 +1218,16 @@ void add_global_var_display (systemtap_session& s)
// Create indices for the foreach loop
for (int i=0; i < idx_count; i++)
{
- idx_tok[i] = new token;
- idx_tok[i]->type = tok_identifier;
char *idx_name;
if (asprintf (&idx_name, "idx%d", i) < 0)
return;
- idx_tok[i]->content = idx_name;
idx_sym[i] = new symbol;
- idx_sym[i]->tok = idx_tok[i];
idx_sym[i]->name = idx_name;
+ idx_sym[i]->tok = l->tok;
idx_v[i] = new vardecl;
idx_v[i]->name = idx_name;
- idx_v[i]->tok = idx_tok[i];
idx_v[i]->type = l->index_types[i];
+ idx_v[i]->tok = l->tok;
idx_sym[i]->referent = idx_v[i];
fe->indexes.push_back (idx_sym[i]);
}
@@ -1274,25 +1264,22 @@ void add_global_var_display (systemtap_session& s)
if (l->type == pe_stats)
{
struct stat_op* so [5];
- token* so_tok [5];
-
- for (unsigned sti = 0; sti < (sizeof(so_tok)/sizeof(token*)); sti++)
- {
- so_tok[sti] = new token;
- so_tok[sti]->type = tok_identifier;
- }
const stat_component_type stypes[] = {sc_count, sc_min, sc_max, sc_sum, sc_average};
- for (unsigned si = 0; si < (sizeof(so_tok)/sizeof(token*)); si++)
+ for (unsigned si = 0;
+ si < (sizeof(so)/sizeof(struct stat_op*));
+ si++)
{
so[si]= new stat_op;
so[si]->ctype = stypes[si];
so[si]->type = pe_long;
so[si]->stat = ai;
- so[si]->tok = so_tok[si];
+ so[si]->tok = l->tok;
}
ai->type = pe_stats;
- for (unsigned si = 0; si < (sizeof(so_tok)/sizeof(token*)); si++)
+ for (unsigned si = 0;
+ si < (sizeof(so)/sizeof(struct stat_op*));
+ si++)
pf->args.push_back(so[si]);
}
else