+
+/* Searches VLS for a value label whose label is exactly LABEL. If successful,
+ returns the corresponding value. Otherwise, returns a null pointer.
+
+ Returns a null pointer if VLS is null.
+
+ This function is O(n) in the number of labels in VLS. */
+const union value *
+val_labs_find_value (const struct val_labs *vls, const char *label_)
+{
+ const union value *value = NULL;
+
+ if (vls != NULL)
+ {
+ const struct val_lab *vl;
+ const char *label;
+
+ label = intern_new (label_);
+ HMAP_FOR_EACH (vl, struct val_lab, node, &vls->labels)
+ if (vl->label == label)
+ {
+ value = &vl->value;
+ break;
+ }
+ intern_unref (label);
+ }
+
+ return value;
+}