[BusyBox] remove type for RESERVE_BB_BUFFER defines
Glenn McGrath
bug1 at optushome.com.au
Tue Mar 6 12:10:54 UTC 2001
Currently the reserve buffers defines only has type char and unsigned
char.
#ifdef BB_FEATURE_BUFFERS_GO_ON_STACK
#define RESERVE_BB_BUFFER(buffer,len) char buffer[len]
#define RESERVE_BB_UBUFFER(buffer,len) unsigned char buffer[len]
#else
#define RESERVE_BB_BUFFER(buffer,len) char
*buffer=xmalloc(len)
#define RESERVE_BB_UBUFFER(buffer,len) unsigned char
*buffer=xmalloc(len)
#endif
If we took out the type we could make it
#ifdef BB_FEATURE_BUFFERS_GO_ON_STACK
#define RESERVE_BB_BUFFER(buffer,len) char buffer[len]
#else
#define RESERVE_BB_BUFFER(buffer,len) *buffer=xmalloc(len)
#endif
Then if we want to define an array of unsigned chars we could do.
RESERVE_BB_BUFFER((unsigned char) buffer,len);
Or if we want to define an array of unsigned long long we could do
RESERVE_BB_BUFFER((unsigned long long) buffer, len * sizeof(unsigned
long long));
I cant see how the current setup could be used to define an array on
non-chars without doing a cast in a seperate statement.
Do these changes make sense ?
Glenn
More information about the busybox
mailing list