new va function: nva which returns a strduped buffer
expr.c options.c:
	use nva instead of strdup (va (...
struct.c type.c:
	make type encoding work properly for structs
This commit is contained in:
Bill Currie 2002-06-13 16:39:33 +00:00
parent b98e52fb53
commit e774943f24
7 changed files with 57 additions and 34 deletions

View file

@ -30,17 +30,18 @@ static const char rcsid[] =
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include <stdarg.h>
#include <stdio.h>
#include "QF/dstring.h"
#include "QF/qtypes.h"
#include "QF/sys.h"
#include "QF/va.h"
#include "compat.h"
/*
va
@ -63,3 +64,19 @@ va (const char *fmt, ...)
return string->str;
}
char *
nva (const char *fmt, ...)
{
va_list args;
static dstring_t *string;
if (!string)
string = dstring_new ();
va_start (args, fmt);
dvsprintf (string, fmt, args);
va_end (args);
return strdup (string->str);
}