doc/list-exports: Use `documentation' to find more categories.
[sod] / lib / sod.c
index aee28d5..a21a599 100644 (file)
--- a/lib/sod.c
+++ b/lib/sod.c
@@ -159,4 +159,32 @@ void *sod_initv(const SodClass *cls, void *p, va_list ap)
   return (p);
 }
 
+/* --- @sod_teardown@ --- *
+ *
+ * Arguments:  @void *p@ = pointer to an instance to be torn down
+ *
+ * Returns:    Zero if the object is torn down; nonzero if it refused for
+ *             some reason.
+ *
+ * Use:                Invokes the instance's `teardown' method to release any held
+ *             resources.
+ *
+ *             If this function returns nonzero, then the object is still
+ *             active, and may still hold important resources.  This is not
+ *             intended to be a failure condition: failures in teardown are
+ *             usually unrecoverable (or very hard to recover from) and
+ *             should probably cause the program to abort.  A refusal, on
+ *             the other hand, means that the object is still live and
+ *             shouldn't be deallocated, but that this is a normal situation
+ *             and the caller shouldn't worry about it.
+ */
+
+int sod_teardown(void *p)
+{
+  SodObject *obj;
+
+  obj = SOD_CONVERT(SodObject, p);
+  return (SodObject_teardown(obj));
+}
+
 /*----- That's all, folks -------------------------------------------------*/