]> git.ozlabs.org Git - ccan/blobdiff - ccan/noerr/noerr.h
tal: allow notifiers on NULL.
[ccan] / ccan / noerr / noerr.h
index 559ba6132840543f4d9a2e4fa1dcb07cb9cdf6fb..bafb59bd021d5ff76d3f6c215afb837d8a2783a5 100644 (file)
@@ -1,5 +1,7 @@
+/* CC0 (Public domain) - see LICENSE file for details */
 #ifndef NOERR_H
 #define NOERR_H
+#include <stdio.h>
 
 /**
  * close_noerr - close without stomping errno.
  */
 int close_noerr(int fd);
 
+/**
+ * fclose_noerr - close without stomping errno.
+ * @fp: the FILE pointer.
+ *
+ * errno is saved and restored across the call to fclose: if an error occurs,
+ * the resulting (non-zero) errno is returned.
+ */
+int fclose_noerr(FILE *fp);
+
 /**
  * unlink_noerr - unlink a file without stomping errno.
  * @pathname: the path to unlink.
@@ -19,4 +30,12 @@ int close_noerr(int fd);
  */
 int unlink_noerr(const char *pathname);
 
+/**
+ * free_noerr - free memory without stomping errno.
+ * @p: the pointer to free.
+ *
+ * errno is saved and restored across the call to free: the standard leaves
+ * that undefined.
+ */
+void free_noerr(void *p);
 #endif /* NOERR_H */