Re: [PATCH 3/8] perf tools: Add formula-* parsing support for events

From: Jiri Olsa
Date: Mon May 06 2013 - 13:47:53 EST


On Fri, May 03, 2013 at 09:07:56AM -0600, David Ahern wrote:
> On 5/1/13 9:15 AM, Jiri Olsa wrote:
> >+static char **formula_add(char **f, char *new)
> >+{
> >+ int i;
> >+#define FORMULAS_CNT 20
> >+
> >+ if (!f) {
> >+ f = zalloc(sizeof(char *) * FORMULAS_CNT + 1);
> >+ if (!f)
> >+ return NULL;
> >+ }
> >+
> >+ for (i = 0; f[i] && (i < FORMULAS_CNT); i++);
> >+
> >+ if (i == FORMULAS_CNT) {
> >+ pr_err("Too many formula defined, max = %d\n",
> >+ FORMULAS_CNT);
> >+ return NULL;
> >+ }
>
> Why have an array of arbitrary limit versus a linked list?

well, I dont need to define new struct, just an array
of string pointers..

jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/