protoverse

A metaverse protocol
git clone git://jb55.com/protoverse
Log | Files | Refs | README | LICENSE

commit 5ac87cda57ab359f8bc268812541261f14e80db0
parent 21956b3d06e49f763a4b430985def1b777c96718
Author: William Casarin <jb55@jb55.com>
Date:   Tue,  1 Dec 2020 12:08:19 -0800

inline memeq

Diffstat:
MMakefile | 1-
Dsrc/util.c | 12------------
Msrc/util.h | 10+++++++++-
3 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/Makefile b/Makefile @@ -8,7 +8,6 @@ OBJS = src/io.o \ src/client.o \ src/net.o \ src/varint.o \ - src/util.o \ src/parser.o \ src/wasm.o diff --git a/src/util.c b/src/util.c @@ -1,12 +0,0 @@ - -#include "util.h" - -#include <memory.h> - -int memeq(void *buf, int buf_len, void *buf2, int buf2_len) -{ - if (buf_len != buf2_len) - return 0; - - return memcmp(buf, buf2, buf_len) == 0; -} diff --git a/src/util.h b/src/util.h @@ -2,6 +2,14 @@ #ifndef PROTOVERSE_UTIL_H #define PROTOVERSE_UTIL_H -int memeq(void *buf, int buf_len, void *buf2, int buf2_len); +#include <string.h> + +static inline int memeq(void *buf, int buf_len, void *buf2, int buf2_len) +{ + if (buf_len != buf2_len) + return 0; + + return memcmp(buf, buf2, buf_len) == 0; +} #endif /* PROTOVERSE_UTIL_H */