lkml.org 
[lkml]   [2015]   [Feb]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v6 1/2] tools lib traceevent: factor out allocating and processing args
On Fri, 27 Feb 2015 14:48:14 +0000
Javi Merino <javi.merino@arm.com> wrote:


> +static int alloc_and_process_arg(struct event_format *event, char *next_token,
> + struct print_arg **print_arg)
> +{
> + struct print_arg *field;
> + enum event_type type;
> + char *token;
> + int ret = 0;
> +
> + field = alloc_arg();
> + if (!field) {
> + do_warning_event(event, "%s: not enough memory!", __func__);
> + errno = ENOMEM;
> + return -1;
> + }
> +
> + type = process_arg(event, field, &token);
> +
> + if (test_type_token(type, token, EVENT_DELIM, next_token)) {

I wonder if we should call this "alloc_and_process_delim()", as this
isn't a generic arg, but only used for deliminators.

-- Steve

> + errno = EINVAL;
> + ret = -1;
> + free_arg(field);
> + goto out_free_token;
> + }
> +
> + *print_arg = field;
> +
> +out_free_token:
> + free_token(token);
> +
> + return ret;
> +}
> +


\
 
 \ /
  Last update: 2015-02-27 17:01    [W:0.310 / U:0.612 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site