+ if (width > 0)
+ v->s = xmalloc (width);
+}
+
+/* Initializes V as a value of the given WIDTH, as with value_init(), and
+ copies SRC's value into V as its initial value. */
+static inline void
+value_clone (union value *v, const union value *src, int width)
+{
+ if (width <= 0)
+ v->f = src->f;
+ else
+ v->s = xmemdup (src->s, width);
+}
+
+/* Returns true if a value of the given WIDTH actually needs to
+ have the value_init and value_destroy functions called, false
+ if those functions are no-ops for values of the given WIDTH.
+
+ Using this function is only a valuable optimization if a large
+ number of values of the given WIDTH are to be initialized*/
+static inline bool
+value_needs_init (int width)
+{
+ return width > 0;
+}
+
+/* Same as value_init, except that failure to allocate memory
+ causes it to return false instead of terminating the
+ program. On success, returns true. */
+static inline bool
+value_try_init (union value *v, int width)
+{
+ if (width > 0)
+ {
+ v->s = malloc (width);
+ return v->s != NULL;
+ }
+ else
+ return true;
+}
+
+/* Frees any memory allocated by value_init for V, which must
+ have the given WIDTH. */
+static inline void
+value_destroy (union value *v, int width)
+{
+ if (width > 0)
+ free (v->s);
+}
+
+/* Copies SRC to DST, given that they both contain data of the
+ given WIDTH. */
+static inline void
+value_copy (union value *dst, const union value *src, int width)
+{
+ if (width <= 0)
+ dst->f = src->f;
+ else
+ memcpy (dst->s, src->s, width);
+}
+
+/* Exchanges the contents of A and B. */
+static inline void
+value_swap (union value *a, union value *b)
+{
+ union value tmp = *a;
+ *a = *b;
+ *b = tmp;
+}
+
+static inline struct substring
+value_ss (const union value *v, int width)
+{
+ return (struct substring) {
+ .string = CHAR_CAST (char *, v->s),
+ .length = width
+ };