]> diplodocus.org Git - nmh/blobdiff - h/utils.h
Print pointers in debug with C99's `%p' rather than `0x%x'.
[nmh] / h / utils.h
index 297746deeafa673ddec7213b050b55672bae5784..dd3fb431815e5b16e19f0bbdbeda2112e8d692c0 100644 (file)
--- a/h/utils.h
+++ b/h/utils.h
@@ -31,6 +31,9 @@ void mh_xfree(void *ptr);
 /* Set p to point to newly allocated, zeroed, memory. */
 #define NEW0(p) ((p) = mh_xcalloc(1, sizeof *(p)))
 
+/* Zero the bytes to which p points. */
+#define ZERO(p) memset((p), 0, sizeof *(p))
+
 char *pwd(void);
 char *add(const char *, char *);
 char *addlist(char *, const char *);
@@ -80,18 +83,7 @@ void trim_suffix_c(char *s, int c);
 void to_lower(char *s);
 void to_upper(char *s);
 
-/*
- * See if a string contains 8 bit characters (use isascii() for the test).
- * Arguments include:
- *
- * start       - Pointer to start of string to test.
- * end         - End of string to test (test will stop before reaching
- *               this point).  If NULL, continue until reaching '\0'.
- *
- * This function always stops at '\0' regardless of the value of 'end'.
- * Returns 1 if the string contains an 8-bit character, 0 if it does not.
- */
-int contains8bit(const char *start, const char *end);
+bool contains8bit(const char *start, const char *end);
 
 /*
  * See if file has any 8-bit bytes.