From: Ralph Corderoy Date: Wed, 19 Oct 2016 23:08:50 +0000 (+0100) Subject: Add LEN(s) definition. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/26ad296a3104a934bff84c1e77b6f73508169959?ds=inline Add LEN(s) definition. LEN gives the strlen() of string constant s, excluding the terminating NUL. --- diff --git a/h/mh.h b/h/mh.h index 513248cf..3c2fb061 100644 --- 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: