]> diplodocus.org Git - nmh/blobdiff - h/mh.h
lock_file.c: close(2) file descriptor on failure, avoiding leak.
[nmh] / h / mh.h
diff --git a/h/mh.h b/h/mh.h
index e1c5827d88e07552ca964452442311f3102990c0..069d9cbea09d508b2750f2e9be33aa0726a4bfb7 100644 (file)
--- a/h/mh.h
+++ b/h/mh.h
 #define DMAXFOLDER     4       /* typical number of digits             */
 #define MAXFOLDER   1000       /* message increment                    */
 
 #define DMAXFOLDER     4       /* typical number of digits             */
 #define MAXFOLDER   1000       /* message increment                    */
 
-/* non-zero exit(3) values indicating the number of errors need to be
- * capped else they interfere with the shell's use of high seven-bit
- * values, and the shell's mapping of signals onto top-bit-set values.
- * Plus, every so often the eight-bit value will wrap to zero, wrongly
- * indicating success. */
-#define MAX_EXIT 120
-
 /*
  * This macro is for use by scan, for example, so that platforms with
  * a small BUFSIZ can easily allocate larger buffers.
  */
 #define NMH_BUFSIZ  max(BUFSIZ, 8192)
 
 /*
  * This macro is for use by scan, for example, so that platforms with
  * a small BUFSIZ can easily allocate larger buffers.
  */
 #define NMH_BUFSIZ  max(BUFSIZ, 8192)
 
-#ifndef FALSE
-#define FALSE false
-#endif
-#ifndef TRUE
-#define TRUE true
-#endif
-typedef unsigned char  boolean;  /* not int so we can pack in a structure */
-
 /* If we're using gcc then tell it extra information so it can do more
  * compile-time checks. */
 #if __GNUC__ > 2
 /* If we're using gcc then tell it extra information so it can do more
  * compile-time checks. */
 #if __GNUC__ > 2
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
-#define ALLOC_SIZE(...) __attribute__((alloc_size(__VA_ARGS__)))
-#define CHECK_PRINTF(fmt, arg) __attribute__((format(printf, fmt, arg)))
-#else  /* gcc < 4.3.0 */
-#define ALLOC_SIZE(...)
-#define CHECK_PRINTF(fmt, arg)
-#endif /* gcc < 4.3.0 */
 #define NORETURN __attribute__((__noreturn__))
 #define CONST __attribute__((const))
 #define MALLOC __attribute__((malloc))
 #define NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
 #define PURE __attribute__((pure))
 #define ENDNULL __attribute__((sentinel))
 #define NORETURN __attribute__((__noreturn__))
 #define CONST __attribute__((const))
 #define MALLOC __attribute__((malloc))
 #define NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
 #define PURE __attribute__((pure))
 #define ENDNULL __attribute__((sentinel))
-#define NMH_UNUSED(i) (void) i
 #else
 #define NORETURN
 #define CHECK_PRINTF(fmt, arg)
 #else
 #define NORETURN
 #define CHECK_PRINTF(fmt, arg)
@@ -63,9 +40,19 @@ typedef unsigned char  boolean;  /* not int so we can pack in a structure */
 #define NONNULL(...)
 #define PURE
 #define ENDNULL
 #define NONNULL(...)
 #define PURE
 #define ENDNULL
-#define NMH_UNUSED(i) i
 #endif
 
 #endif
 
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#define ALLOC_SIZE(...) __attribute__((alloc_size(__VA_ARGS__)))
+#define CHECK_PRINTF(fmt, arg) __attribute__((format(printf, fmt, arg)))
+#else
+#define ALLOC_SIZE(...)
+#define CHECK_PRINTF(fmt, arg)
+#endif
+
+/* Silence the compiler's "unused variable" warning. */
+#define NMH_UNUSED(i) (void)i
+
 /* DIM gives the number of elements in the one-dimensional array a. */
 #define DIM(a) (sizeof (a) / sizeof (*(a)))
 
 /* DIM gives the number of elements in the one-dimensional array a. */
 #define DIM(a) (sizeof (a) / sizeof (*(a)))