Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 169498
b: refs/heads/master
c: b99af87
h: refs/heads/master
v: v3
  • Loading branch information
Steven Rostedt authored and Ingo Molnar committed Oct 15, 2009
1 parent d1e4901 commit d11497a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 29 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: 0959b8d65ce26131c2d5ccfa518a7b76529280fa
refs/heads/master: b99af874829cba2b30d212bc6fd31b56275ee4d2
50 changes: 22 additions & 28 deletions trunk/tools/perf/util/trace-event-parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,24 @@ process_op(struct event *event, struct print_arg *arg, char **tok)

right = malloc_or_die(sizeof(*right));

type = process_arg(event, right, tok);
type = read_token_item(&token);
*tok = token;

/* could just be a type pointer */
if ((strcmp(arg->op.op, "*") == 0) &&
type == EVENT_DELIM && (strcmp(token, ")") == 0)) {
if (left->type != PRINT_ATOM)
die("bad pointer type");
left->atom.atom = realloc(left->atom.atom,
sizeof(left->atom.atom) + 3);
strcat(left->atom.atom, " *");
*arg = *left;
free(arg);

return type;
}

type = process_arg_token(event, right, tok, type);

arg->op.right = right;

Expand Down Expand Up @@ -1548,34 +1565,18 @@ process_paren(struct event *event, struct print_arg *arg, char **tok)
{
struct print_arg *item_arg;
enum event_type type;
int ptr_cast = 0;
char *token;

type = process_arg(event, arg, &token);

if (type == EVENT_ERROR)
return EVENT_ERROR;

if (type == EVENT_OP) {
/* handle the ptr casts */
if (!strcmp(token, "*")) {
/*
* FIXME: should we zapp whitespaces before ')' ?
* (may require a peek_token_item())
*/
if (__peek_char() == ')') {
ptr_cast = 1;
free_token(token);
type = read_token_item(&token);
}
}
if (!ptr_cast) {
type = process_op(event, arg, &token);
if (type == EVENT_OP)
type = process_op(event, arg, &token);

if (type == EVENT_ERROR)
return EVENT_ERROR;
}
}
if (type == EVENT_ERROR)
return EVENT_ERROR;

if (test_type_token(type, token, EVENT_DELIM, (char *)")")) {
free_token(token);
Expand All @@ -1601,13 +1602,6 @@ process_paren(struct event *event, struct print_arg *arg, char **tok)
item_arg = malloc_or_die(sizeof(*item_arg));

arg->type = PRINT_TYPE;
if (ptr_cast) {
char *old = arg->atom.atom;

arg->atom.atom = malloc_or_die(strlen(old + 3));
sprintf(arg->atom.atom, "%s *", old);
free(old);
}
arg->typecast.type = arg->atom.atom;
arg->typecast.item = item_arg;
type = process_arg_token(event, item_arg, &token, type);
Expand Down

0 comments on commit d11497a

Please sign in to comment.