#include "libpspp/pool.h"
#include "libpspp/str.h"
-#include "gl/intprops.h"
#include "gl/minmax.h"
#include "gl/xalloc.h"
#include "gl/xmemdup0.h"
static void
error (struct pfm_reader *r, const char *msg, ...)
{
- struct msg m;
struct string text;
va_list args;
ds_put_vformat (&text, msg, args);
va_end (args);
- m.category = MSG_C_GENERAL;
- m.severity = MSG_S_ERROR;
- m.file_name = NULL;
- m.first_line = 0;
- m.last_line = 0;
- m.first_column = 0;
- m.last_column = 0;
- m.text = ds_cstr (&text);
-
+ struct msg m = {
+ .category = MSG_C_GENERAL,
+ .severity = MSG_S_ERROR,
+ .text = ds_cstr (&text),
+ };
msg_emit (&m);
r->ok = false;
static void
warning (struct pfm_reader *r, const char *msg, ...)
{
- struct msg m;
struct string text;
va_list args;
ds_put_vformat (&text, msg, args);
va_end (args);
- m.category = MSG_C_GENERAL;
- m.severity = MSG_S_WARNING;
- m.file_name = NULL;
- m.first_line = 0;
- m.last_line = 0;
- m.first_column = 0;
- m.last_column = 0;
- m.text = ds_cstr (&text);
-
+ struct msg m = {
+ .category = MSG_C_GENERAL,
+ .severity = MSG_S_WARNING,
+ .text = ds_cstr (&text),
+ };
msg_emit (&m);
}
struct pfm_reader *r = pfm_reader_cast (r_);
bool ok;
- dict_destroy (r->dict);
+ dict_unref (r->dict);
any_read_info_destroy (&r->info);
if (r->file)
{
unsigned long int i;
for (i = 1; ; i++)
{
- char try_name[8 + 1 + INT_STRLEN_BOUND (i) + 1];
- sprintf (try_name, "%s_%lu", name, i);
+ char *try_name = xasprintf ("%s_%lu", name, i);
v = dict_create_var (dict, try_name, width);
+ free (try_name);
if (v != NULL)
break;
}