Re: [PATCH v2 6/7] tracing: Handle synthetic event array field type checking correctly

From: Steven Rostedt
Date: Mon Oct 12 2020 - 18:14:20 EST


On Mon, 12 Oct 2020 15:18:08 -0500
Tom Zanussi <zanussi@xxxxxxxxxx> wrote:

> @@ -630,8 +630,11 @@ static struct synth_field *parse_synth_field(int argc, const char **argv,
> if (field_type[0] == ';')
> field_type++;
> len = strlen(field_type) + 1;
> - if (array)
> + if (array) {
> len += strlen(array);
> + if (array[strlen(array) - 1] == ';')
> + len--;
> + }

Why not:

if (array) {
int l = strlen(array);

if (l && array[l - 1] == ';')
l--;
len += l;
}

-- Steve