#include <unistd.h>
#include "libpspp/cast.h"
+#include "libpspp/intern.h"
#include "libpspp/str.h"
#include "libpspp/version.h"
#include "data/settings.h"
void
msg_location_uninit (struct msg_location *loc)
{
- free (loc->file_name);
+ intern_unref (loc->file_name);
}
void
struct msg_location *dst = xmalloc (sizeof *dst);
*dst = (struct msg_location) {
- .file_name = xstrdup_if_nonnull (src->file_name),
+ .file_name = intern_new_if_nonnull (src->file_name),
.first_line = src->first_line,
.last_line = src->last_line,
.first_column = src->first_column,
{
if (stack)
{
- msg_location_uninit (&stack->location);
+ msg_location_destroy (stack->location);
free (stack->description);
free (stack);
}
{
struct msg_stack *dst = xmalloc (sizeof *src);
*dst = (struct msg_stack) {
- .location = src->location,
+ .location = msg_location_dup (src->location),
.description = xstrdup_if_nonnull (src->description),
};
- dst->location.file_name = xstrdup_if_nonnull (dst->location.file_name);
return dst;
}
\f
for (size_t i = 0; i < m->n_stack; i++)
{
const struct msg_stack *ms = m->stack[i];
- if (!msg_location_is_empty (&ms->location))
+ if (!msg_location_is_empty (ms->location))
{
- msg_location_format (&ms->location, &s);
+ msg_location_format (ms->location, &s);
ds_put_cstr (&s, ": ");
}
ds_put_format (&s, "%s\n", ms->description);