#include <stdlib.h>
#include "libpspp/compiler.h"
+#include "libpspp/str.h"
#include "output/driver.h"
#include "output/output-item-provider.h"
group_open_item_create (const char *command_name, const char *label)
{
return group_open_item_create_nocopy (
- command_name ? xstrdup (command_name) : NULL,
- label ? xstrdup (label) : NULL);
+ xstrdup_if_nonnull (command_name),
+ xstrdup_if_nonnull (label));
}
struct group_open_item *
*item = (struct group_open_item) {
.output_item = OUTPUT_ITEM_INITIALIZER (&group_open_item_class),
.output_item.label = label,
- .command_name = command_name,
+ .output_item.command_name = command_name,
};
return item;
}
{
struct group_open_item *item = to_group_open_item (output_item);
- return item->command_name ? item->command_name : _("Group");
+ return (item->output_item.command_name
+ ? item->output_item.command_name
+ : _("Group"));
}
static void
{
struct group_open_item *item = to_group_open_item (output_item);
- free (item->command_name);
free (item);
}