}
/* If VLS does not already contain a value label for VALUE, adds
- LABEL for it and returns nonzero. Otherwise, returns zero.
+ LABEL for it and returns true. Otherwise, returns false.
Behavior is undefined if VLS's width is greater than
MAX_SHORT_STRING. */
-int
+bool
val_labs_add (struct val_labs *vls, union value value, const char *label)
{
struct int_val_lab *ivl;
if (*vlpp == NULL)
{
*vlpp = ivl;
- return 1;
- }
- else
- {
- free_int_val_lab (ivl, vls);
- return 0;
+ return true;
}
+ free_int_val_lab (ivl, vls);
+ return false;
}
-/* Sets LABEL as the value label for VALUE in VLS. Returns zero
- if there wasn't already a value label for VALUE, or nonzero if
+/* Sets LABEL as the value label for VALUE in VLS. Returns false
+ if there wasn't already a value label for VALUE, or true if
there was. Behavior is undefined if VLS's width is greater
than MAX_SHORT_STRING. */
-int
+bool
val_labs_replace (struct val_labs *vls, union value value, const char *label)
{
struct int_val_lab *ivl;
if (vls->labels == NULL)
{
val_labs_add (vls, value, label);
- return 0;
+ return false;
}
ivl = hsh_replace (vls->labels, create_int_val_lab (vls, value, label));
if (ivl == NULL)
- return 0;
+ return false;
else
{
free_int_val_lab (ivl, vls);
- return 1;
+ return true;
}
}
-/* Removes any value label for VALUE within VLS. Returns nonzero
+/* Removes any value label for VALUE within VLS. Returns true
if a value label was removed. Behavior is undefined if VLS's
width is greater than MAX_SHORT_STRING. */
-int
+bool
val_labs_remove (struct val_labs *vls, union value value)
{
assert (vls != NULL);
return deleted;
}
else
- return 0;
+ return false;
}
/* Searches VLS for a value label for VALUE. If successful,