From 4d1121dbe7244537fc76757552345ea0e8f87a03 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 10 Aug 2009 23:38:48 -0700 Subject: http: add CONST_MEM_EQ macro For comparing a raw memory space against a constant --- ext/unicorn_http/c_util.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ext/unicorn_http/c_util.h b/ext/unicorn_http/c_util.h index 424e861..1c085ae 100644 --- a/ext/unicorn_http/c_util.h +++ b/ext/unicorn_http/c_util.h @@ -97,4 +97,7 @@ static off_t parse_length(const char *value, size_t length) return rv; } +#define CONST_MEM_EQ(const_p, buf, len) \ + ((sizeof(const_p) - 1) == len && !memcmp(const_p, buf, sizeof(const_p) - 1)) + #endif /* UH_util_h */ -- cgit v1.2.3-24-ge0c7