X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/f518dbaf46eb28bd39695474de6118683d905e5f..a17187e56386747a9b4d9633c3d116c2087f2b8b:/src/system.h diff --git a/src/system.h b/src/system.h index 7aa2c9fa..f0a76ceb 100644 --- a/src/system.h +++ b/src/system.h @@ -42,6 +42,15 @@ #define STREQ(L, R) (strcmp(L, R) == 0) #define STRNEQ(L, R) (!STREQ(L, R)) +/* Just like strncmp, but the second argument must be a literal string + and you don't specify the length. */ +#define STRNCMP_LIT(S, Literal) \ + strncmp (S, "" Literal "", sizeof (Literal) - 1) + +/* Whether Literal is a prefix of S. */ +#define STRPREFIX_LIT(Literal, S) \ + (STRNCMP_LIT (S, Literal) == 0) + #if HAVE_SYS_TYPES_H # include #endif