Switch/ext/ebtree/ebtree/common/chunk.h
static inline char *chunk_newstr(struct chunk *chk)
{
	if (chk->len < 0 || chk->len + 1 >= chk->size)
		return NULL;

	chk->str[chk->len++] = 0;
	return chk->str + chk->len;
}
/* Adds a trailing zero to the current chunk and returns the pointer to the
 * following part. The purpose is to be able to use a chunk as a series of
 * short independant strings with chunk_* functions, which do not need to be
 * released. Returns NULL if no space is available to ensure that the new
 * string will have its own trailing zero. For example :
 *   chunk_init(&trash);
 *   pid = chunk_newstr(&trash);
 *   chunk_appendf(&trash, "%d", getpid()));
 *   name = chunk_newstr(&trash);
 *   chunk_appendf(&trash, "%s", gethosname());
 *   printf("hostname=<%s>, pid=<%d>\n", name, pid);
 */
Adds a trailing zero to the current chunk and returns the pointer to the
following part. The purpose is to be able to use a chunk as a series of
short independant strings with chunk_* functions, which do not need to be
released. Returns NULL if no space is available to ensure that the new
string will have its own trailing zero.
Adds a trailing zero to the current chunk and returns the pointer to the following part . The purpose is to be able to use a chunk as a series of short independant strings with chunk_ * functions which do not need to be released . Returns NULL if no space is available to ensure that the new string will have its own trailing zero .
static inline char *chunk_newstr(struct chunk *chk)
{
	if (chk->len < 0 || chk->len + 1 >= chk->size)
		return NULL;
	chk->str[chk->len++] = 0;
	return chk->str + chk->len;
}
static inline char * chunk_newstr ( struct chunk * chk ) { if ( chk -> len < 0 || chk -> len + 1 >= chk -> size ) return NULL ; chk -> str [ chk -> len ++ ] = 0 ; return chk -> str + chk -> len ; }
Adds a trailing zero to the current chunk and returns the pointer to the
 following part.
Adds a trailing zero to the current chunk and returns the pointer to the following part .