+ char **ptr;
+ struct prop_hdr *p;
+
+ /* NAME is special, as it can be a literal: see find_name_property */
+ assert(type != NAME);
+ for (ptr = &t->prop; *ptr; ptr = &p->next) {
+ if (!is_prop_hdr(*ptr))
+ break;
+ p = (struct prop_hdr *)*ptr;
+ if (p->type == type)
+ return ptr;
+ }
+ return NULL;
+}
+
+/* This is special:
+ * NULL - not found
+ * *literal: true - char **, pointer to literal pointer.
+ * *literal: false - struct prop_hdr **, pointer to header ptr.
+ */
+static char **find_name_property(struct tal_hdr *t, bool *literal)
+{
+ char **ptr;
+ struct prop_hdr *p;
+
+ for (ptr = &t->prop; *ptr; ptr = &p->next) {
+ if (!is_prop_hdr(*ptr)) {
+ *literal = true;
+ return ptr;
+ }
+ p = (struct prop_hdr *)*ptr;
+ if (p->type == NAME) {
+ *literal = false;
+ return ptr;
+ }
+ }
+ return NULL;