#include "data/identifier.h"
#include "libpspp/assertion.h"
#include "libpspp/cast.h"
+#include "libpspp/misc.h"
+
#include "gl/ftoastr.h"
#include "gl/xalloc.h"
{
char buffer[DBL_BUFSIZE_BOUND];
- dtoastr (buffer, sizeof buffer, 0, 0, fabs (token->number));
+ c_dtoastr (buffer, sizeof buffer, 0, 0, fabs (token->number));
return (token->type == T_POS_NUM
? xstrdup (buffer)
: xasprintf ("-%s", buffer));
char *
token_to_string (const struct token *token)
{
- const char *name;
-
switch (token->type)
{
case T_POS_NUM:
return string_representation (token->string);
default:
- name = token_type_to_name (token->type);
- return name != NULL ? xstrdup (name) : NULL;
+ return xstrdup_if_nonnull (token_type_to_name (token->type));
}
}
{
char s[DBL_BUFSIZE_BOUND];
- dtoastr (s, sizeof s, 0, 0, token->number);
+ c_dtoastr (s, sizeof s, 0, 0, token->number);
fprintf (stream, "\t%s", s);
}
if (token->type == T_ID || token->type == T_STRING || token->string.length)