From f9f707033665dc737f1011e82406a12fafa78326 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 10 Mar 2013 06:18:03 +0000 Subject: add STREQ macro (commonly used macro like CLAMP, MAX2, STRINGIFY). Use for some areas of the python api, bmesh. --- source/blender/blenlib/BLI_utildefines.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'source/blender/blenlib') diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index 868b2a54f28..bf5531d94af 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -326,6 +326,22 @@ typedef bool _BLI_Bool; #define STRINGIFY_APPEND(a, b) "" a #b #define STRINGIFY(x) STRINGIFY_APPEND("", x) +/* generic strcmp macros */ +#define STREQ(a, b) (strcmp(a, b) == 0) +#define STRNEQ(a, b) (!STREQ(a, b)) + +#define STRCASEEQ(a, b) (strcasecmp(a, b) == 0) +#define STRCASENEQ(a, b) (!STRCASEEQ(a, b)) + +#define STREQLEN(a, b, n) (strncmp(a, b, n) == 0) +#define STRNEQLEN(a, b, n) (!STREQLEN(a, b, n)) + +#define STRCASEEQLEN(a, b, n) (strncasecmp(a, b, n) == 0) +#define STRCASENEQLEN(a, b, n) (!STRCASEEQLEN(a, b, n)) + +#define STRPREFIX(a, b) (strncmp((a), (b), strlen(b)) == 0) + + /* useful for debugging */ #define AT __FILE__ ":" STRINGIFY(__LINE__) -- cgit v1.2.3