+ * Free a set of format instructions.
+ *
+ * What we do here is:
+ *
+ * - Iterate through the list of format instructions, freeing any references
+ * to allocated memory in each instruction.
+ * - Free component references.
+ * - If requested, reset the component hash table; that will also free any
+ * references to components stored there.
+ *
+ */
+
+void
+fmt_free(struct format *fmt, int reset_comptable)
+{
+ struct format *fp = fmt;
+
+ if (fp) {
+ while (! (fp->f_type == FT_DONE && fp->f_value == 0)) {
+ if (fp->f_flags & FF_STRALLOC)
+ free(fp->f_text);
+ if (fp->f_flags & FF_COMPREF)
+ free_component(fp->f_comp);
+ }
+ free(fmt);
+ }
+
+ if (reset_comptable)
+ free_comptable();
+}
+
+/*
+ * Find a component in our hash table. This is just a public interface to
+ * the FINDCOMP macro, so we don't have to expose our hash table.
+ */
+
+struct comp *
+fmt_findcomp(char *component)
+{
+ struct comp *cm;
+
+ FINDCOMP(cm, component);
+
+ return cm;
+}
+
+/*