Exemple #1
0
static char *stringify_fields(const struct list_head *field_head)
{
	char *field_str, *fields = NULL;
	struct field *field;

	list_for_each_entry(field, field_head, list) {
		field_str = stringify_field(field);
		xstrappend(&fields, field_str);
		free(field_str);
	}
Exemple #2
0
static char *stringify_fields(const struct field *field_head)
{
	char *field_str, *fields = NULL;

	for (const struct field *field = field_head; field; field = field->next) {
		field_str = stringify_field(field);
		xstrappend(&fields, field_str);
		free(field_str);
	}
	if (fields)
		xstrappend(&fields, "0\taction\t\taction\n0\tmethod\t\tmethod\n");
	else
		fields = xstrdup("");

	field_str = NULL;
	bytes_to_hex(fields, &field_str, strlen(fields));
	free(fields);

	return field_str;
}