diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-08-10 23:38:48 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-08-10 23:38:48 -0700 |
commit | 4d1121dbe7244537fc76757552345ea0e8f87a03 (patch) | |
tree | d584be7b851e0f71b5b3c58f76cbdae05d4ef7e2 | |
parent | 7451ef8159decc95245fe193e04bcf3d433095a3 (diff) | |
download | unicorn-4d1121dbe7244537fc76757552345ea0e8f87a03.tar.gz |
For comparing a raw memory space against a constant
-rw-r--r-- | ext/unicorn_http/c_util.h | 3 |
1 files changed, 3 insertions, 0 deletions
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 */ |