]> diplodocus.org Git - nmh/commitdiff
Add LEN(s) definition.
authorRalph Corderoy <ralph@inputplus.co.uk>
Wed, 19 Oct 2016 23:08:50 +0000 (00:08 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Wed, 19 Oct 2016 23:08:50 +0000 (00:08 +0100)
LEN gives the strlen() of string constant s, excluding the
terminating NUL.

h/mh.h

diff --git a/h/mh.h b/h/mh.h
index 513248c..3c2fb06 100644 (file)
--- a/h/mh.h
+++ b/h/mh.h
@@ -43,6 +43,10 @@ typedef unsigned char  boolean;  /* not int so we can pack in a structure */
 #define NMH_UNUSED(i) i
 #endif
 
+/* LEN gives the strlen() of string constant s, excluding the
+ * terminating NUL. */
+#define LEN(s) (sizeof (s) - 1)
+
 /*
  * char array that keeps track of size in both bytes and characters
  * Usage note: