From 68677103048a6be41d373e81fa2dcb422328fcee Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 1 Sep 2015 01:58:01 +0200 Subject: mds-kbdc: minor optimisation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/libmdsserver/macros.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/libmdsserver/macros.h') diff --git a/src/libmdsserver/macros.h b/src/libmdsserver/macros.h index f17da94..f177c1e 100644 --- a/src/libmdsserver/macros.h +++ b/src/libmdsserver/macros.h @@ -725,6 +725,19 @@ do { if (condition) { instructions return 1; } } while (0) +/** + * The way to get a pointer to the end of a string + * + * `strchr(str, '\0')` is faster than `str + strlen(str)`, + * at least in the GNU C Library. If this is not true for + * the compiler you are using, you may want to edit this + * macro. + */ +#define STREND(str) \ + (strchr(str, '\0')) +/* TODO Document STREND in the texinfo manual. */ + + /** * The system is running out of memory. * Quick, free up all your unused memory or kill yourself! -- cgit v1.2.3-70-g09d2