Re: kconfig: avoid temporary file

From: Roman Zippel
Date: Sun Jan 02 2005 - 20:07:29 EST


Hi,

On Friday 31 December 2004 00:52, Sam Ravnborg wrote:

> # scripts/kconfig/mconf.c
> # 2004/12/30 22:29:51+01:00 sam@xxxxxxxxxxxxxxxxx +78 -28
> # introduce a general growable string.
> # Allow us to skip one additional temporary file

I'm not really against the change, but the reason is weird. In the end the
string is still written to a file anyway...

> +/* Growable string. Allocates memory as needed when string expands */
> +struct gstr {
> + char *s;
> + size_t len;
> +};

I would prefer something more like this:

struct gstr {
int size;
char s[0];
};

and this would be better names for the functions:

struct gstr *str_new(void);
void str_free(struct gstr *gs);
void str_append(struct gstr *gs, const char *s);

It would be useful to have these sort of functions in the library, so we can
e.g. use them to dynamically generate the help text.

bye, Roman
-
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/