Permalink
Browse files

Remove EI dependency (File format changes)

Change-Id: Ib90f14b868f0f784ce291b14770cecff67c8d6ba
  • Loading branch information...
1 parent 829fffa commit 871500b2e979fa6122a140e6be92cd37f94aa324 @apage43 committed Mar 2, 2012
Showing with 607 additions and 899 deletions.
  1. +6 −7 Makefile.am
  2. +0 −11 configure.ac
  3. +61 −0 src/bitfield.h
  4. +214 −333 src/btree_modify.c
  5. +25 −49 src/btree_read.c
  6. +12 −17 src/couch_btree.h
  7. +189 −263 src/couch_db.c
  8. +9 −8 src/couch_file_read.c
  9. +6 −11 src/couch_file_write.c
  10. +1 −0 src/couchscript.cc
  11. +8 −4 src/dbdump.c
  12. +4 −6 src/dbinfo.c
  13. +5 −2 src/internal.h
  14. +39 −87 src/reduces.c
  15. +4 −4 src/reduces.h
  16. +17 −45 src/util.c
  17. +1 −19 src/util.h
  18. +6 −33 tests/testapp.c
View
@@ -59,8 +59,8 @@ libcouchstore_la_SOURCES = \
src/util.c \
src/util.h
-libcouchstore_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LIBCOUCHSTORE_API_CURRENT):$(LIBCOUCHSTORE_API_REVISION):$(LIBCOUCHSTORE_API_AGE) -no-undefined $(ERL_INTERFACE_DIR_LIB) -lei -lsnappy
-libcouchstore_la_CFLAGS = $(AM_CFLAGS) -DLIBCOUCHSTORE_INTERNAL=1 $(ERL_INTERFACE_DIR_INCLUDE)
+libcouchstore_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LIBCOUCHSTORE_API_CURRENT):$(LIBCOUCHSTORE_API_REVISION):$(LIBCOUCHSTORE_API_AGE) -no-undefined -lsnappy
+libcouchstore_la_CFLAGS = $(AM_CFLAGS) -DLIBCOUCHSTORE_INTERNAL=1
libcouchstore_la_LIBADD = librfc1321.la libbyteswap.la
couch_dbdump_SOURCES = src/dbdump.c
@@ -69,7 +69,7 @@ couch_dbdump_CFLAGS = $(AM_CFLAGS) -D__STDC_FORMAT_MACROS
couch_dbdump_LDADD = libcouchstore.la libbyteswap.la -lsnappy
couch_dbinfo_SOURCES = src/dbinfo.c src/util.c
-couch_dbinfo_CFLAGS = $(AM_CFLAGS) $(ERL_INTERFACE_DIR_INCLUDE) -D__STDC_FORMAT_MACROS
+couch_dbinfo_CFLAGS = $(AM_CFLAGS) -D__STDC_FORMAT_MACROS
couch_dbinfo_DEPENDENCIES = libcouchstore.la libbyteswap.la
couch_dbinfo_LDADD = libcouchstore.la libbyteswap.la
#writetest_SOURCES = src/writetest.c
@@ -110,10 +110,9 @@ check_PROGRAMS = testapp
TESTS = ${check_PROGRAMS}
testapp_SOURCES = tests/testapp.c src/util.c tests/macros.h
-testapp_CFLAGS = $(AM_CFLAGS) $(ERL_INTERFACE_DIR_INCLUDE)
-testapp_LDFLAGS = $(ERL_INTERFACE_DIR_LIB) -lei
-testapp_DEPENDENCIES = libcouchstore.la
-testapp_LDADD = libcouchstore.la
+testapp_CFLAGS = $(AM_CFLAGS)
+testapp_DEPENDENCIES = libcouchstore.la libbyteswap.la
+testapp_LDADD = libcouchstore.la libbyteswap.la
test: check-TESTS $(extra_tests)
View
@@ -55,17 +55,6 @@ AC_SEARCH_LIBS(floor, m)
AC_SEARCH_LIBS(pow, m)
AC_SEARCH_LIBS(fabs, m)
-AC_PATH_PROG([ERL], [erl])
-AS_IF([test x${ERL} = x], [
- AC_MSG_ERROR([Could not find the erl executable. Is Erlang installed?])
- ])
-
-ERL_INTERFACE_DIR_INCLUDE="-I`${ERL} -eval 'io:put_chars(code:lib_dir(erl_interface) ++ "/include"), erlang:halt().' -noshell -noinput`"
-AC_SUBST(ERL_INTERFACE_DIR_INCLUDE)
-ERL_INTERFACE_DIR_LIB="-L`${ERL} -eval 'io:put_chars(code:lib_dir(erl_interface) ++ "/lib"), erlang:halt().' -noshell -noinput`"
-AC_SUBST(ERL_INTERFACE_DIR_LIB)
-
-
AC_ARG_WITH([docs],
[AS_HELP_STRING([--with-docs],
[Generate documentation (yes|no) @<:@default=yes@:>@])],
View
@@ -0,0 +1,61 @@
+#ifndef COUCH_BITFIELD_H
+#define COUCH_BITFIELD_H
+#include "config_static.h"
+static inline uint64_t get_48(char *buf)
+{
+ uint64_t num = 0;
+ char *numbuf = (char *) &num;
+ memcpy(numbuf + 2, buf, 6);
+ return ntohll(num);
+}
+
+
+static inline uint64_t get_40(char *buf)
+{
+ uint64_t num = 0;
+ char *numbuf = (char *) &num;
+ memcpy(numbuf + 3, buf, 5);
+ return ntohll(num);
+}
+
+static inline uint32_t get_32(char *buf)
+{
+ uint32_t num = *((uint32_t *) buf);
+ return ntohl(num);
+}
+
+
+static inline uint32_t get_16(char *buf)
+{
+ uint32_t num = 0;
+ char *numbuf = (char *) &num;
+ memcpy(numbuf + 2, buf, 2);
+ return ntohl(num);
+}
+
+static inline void get_kvlen(char *buf, int *klen, int *vlen)
+{
+ //12, 28 bit
+ uint32_t num = 0;
+ char *numbuf = (char *) &num;
+ memcpy(numbuf + 2, buf, 2);
+ *klen = ntohl(num) >> 4;
+ num = 0;
+ numbuf = (char *) &num;
+ memcpy(numbuf, buf + 1, 4);
+ *vlen = ntohl(num) & 0x0FFFFFFF;
+}
+
+//Flip on the the bits of num as a numbits-bit number, offset bitpos bits into
+//buf. MUST ZERO MEMORY _BEFORE_ WRITING TO IT!
+static inline void set_bits(char *buf, const int bitpos, const int numbits, uint64_t num)
+{
+ num = num << (64 - (numbits + bitpos));
+ num = htonll(num);
+ char *nbuf = (char *) &num;
+ int i = 0;
+ for (i = 0; i < ((numbits + bitpos + 7) / 8); i++) {
+ buf[i] |= nbuf[i];
+ }
+}
+#endif
Oops, something went wrong.

0 comments on commit 871500b

Please sign in to comment.