mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-14 23:03:04 +00:00
Minor code cleanup.
* src/muscle-tab.c (MUSCLE_USER_NAME_CONVERT): Remove macro and replace all uses with UNIQSTR_CONCAT. * src/uniqstr.c (uniqstr_vsprintf): New function. * src/uniqstr.h (uniqstr_vsprintf): Add prototype. (UNIQSTR_CONCAT, UNIQSTR_GEN_FORMAT, UNIQSTR_GEN_FORMAT_): New macros.
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include <error.h>
|
||||
#include <hash.h>
|
||||
#include <quotearg.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "uniqstr.h"
|
||||
|
||||
@@ -53,6 +54,21 @@ uniqstr_new (char const *str)
|
||||
return res;
|
||||
}
|
||||
|
||||
uniqstr
|
||||
uniqstr_vsprintf (char const *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
size_t length;
|
||||
va_start (args, format);
|
||||
length = vsnprintf (NULL, 0, format, args);
|
||||
va_end (args);
|
||||
|
||||
char res[length + 1];
|
||||
va_start (args, format);
|
||||
vsprintf (res, format, args);
|
||||
va_end (args);
|
||||
return uniqstr_new (res);
|
||||
}
|
||||
|
||||
/*------------------------------.
|
||||
| Abort if S is not a uniqstr. |
|
||||
|
||||
Reference in New Issue
Block a user