[PATCH] introduce CONFIG_BUFFER_SIZE()

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Tue Jul 27 14:52:16 UTC 2010


On Tue, Jul 27, 2010 at 05:21:58PM +0300, Alexander Shishkin wrote:
>Since "sizeof buffer" won't work with dynamically allocated buffers,
>and we still sometimes need to know the size of the whole buffer, we
>need a way to always obtain said size.

I don't quite understand?
You have these three:
char b1[PROCPS_BUFSIZE]
char b2[FILENAME_MAX]
char b3[BUFSIZ]
you
RESERVE_CONFIG_BUFFER(b1, PROCPS_BUFSIZE)
RESERVE_CONFIG_BUFFER(b2, FILENAME_MAX)
RESERVE_CONFIG_BUFFER(b3, BUFSIZ)
and
RELEASE_CONFIG_BUFFER(b1)
accordingly.

Where do you need "sizeof(PROCPS_BUFSIZE)" as opposed to
"PROCPS_BUFSIZE", for example?

What am i missing?

cheers,


More information about the busybox mailing list