/* @disp: Display structure, holding info about our options @headp: Pointer to header pointer of list @type: Type of this value (FDT_IS_...)  1 if we want to include matches, 0 to exclude @str: String value to match  */
static int value_add(struct display_info *disp, struct value_node **headp, int type, int include, const char *str)
/* @disp: Display structure, holding info about our options @headp: Pointer to header pointer of list @type: Type of this value (FDT_IS_...)  1 if we want to include matches, 0 to exclude @str: String value to match  */
static int value_add(struct display_info *disp, struct value_node **headp, int type, int include, const char *str)
{
	struct value_node *node;
	if (include)
		disp->types_inc |= type;
	else
		disp->types_exc |= type;
	if (disp->types_inc & disp->types_exc & type) {
		fprintf(stderr,
			"Cannot use both include and exclude for '%s'\n", str);
		return -1;
	}
	str = strdup(str);
	if (!str)
		goto err_mem;
	node = malloc(sizeof(*node));
	if (!node)
		goto err_mem;
	node->next = *headp;
	node->type = type;
	node->include = include;
	node->string = str;
	*headp = node;
	return 0;
err_mem:
	fprintf(stderr, "Out of memory\n");
	return -1;
}