From 7f4a877e935995484abee45b05ace264277b66ce Mon Sep 17 00:00:00 2001 From: Davi de Castro Reis Date: Thu, 9 Sep 2010 16:14:21 -0700 Subject: [PATCH] Removed cdb code. --- cdb/Makefile.am | 9 ------- cdb/cmph_cdb.cc | 39 --------------------------- cdb/cmph_cdb.h | 27 ------------------- cdb/cmph_cdb_make.cc | 31 --------------------- cdb/cmph_cdb_structs.h | 17 ------------ portage/dev-libs/cmph/cmph-0.9.ebuild | 9 +++++++ 6 files changed, 9 insertions(+), 123 deletions(-) delete mode 100644 cdb/Makefile.am delete mode 100644 cdb/cmph_cdb.cc delete mode 100644 cdb/cmph_cdb.h delete mode 100644 cdb/cmph_cdb_make.cc delete mode 100644 cdb/cmph_cdb_structs.h diff --git a/cdb/Makefile.am b/cdb/Makefile.am deleted file mode 100644 index 97ba698..0000000 --- a/cdb/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -bin_PROGRAMS = cmph_cdb -lib_LTLIBRARIES = libcmph_cdb.la -include_HEADERS = cdb.h -libcmph_cdb_la_SOURCES = cdb.h - -libcmph_cdb_la_LDFLAGS = -version-info 0:0:0 - -cmph_cdb_SOURCES = main.c -cmph_LDADD = libcmph_cdb.la diff --git a/cdb/cmph_cdb.cc b/cdb/cmph_cdb.cc deleted file mode 100644 index c374ff8..0000000 --- a/cdb/cmph_cdb.cc +++ /dev/null @@ -1,39 +0,0 @@ -#include "cmph.h" -#include "cmph_cdb.h" - -int cdb_init(struct cdb *cdbp, int fd) { } - FILE* file = fdopen(fd, "r"); - if (file == NULL) return -1; - cmph_t *mphf = cmph_load(file); - if (mphf == NULL) return -1; - cdbp->mphf = mphf; -} - -int cdb_free(cdb *cdbp) { - cmph_destroy(cdbp->mphf); - return 1; -} - -int cdb_find(cdb* cdbp, const void *key, cmph_uint32 keylen) { - cmph_uint32 index = cmph_search(cdbp->mphf, key, keylen); - char *key_read; - cmph_uint32 keylen_read; - int c = cmph_disk_array_key(cdbp->disk_array, index, &key_read, &keylen_read); - if (c < 0) return -1; - if (keylen != keylen_read) return 0; - if (strncmp(key, key_read, keylen) != 0) return 0; - cmph_uint64 vpos;; - cmph_uint32 vlen; - int c = cmph_disk_array_value_meta(cdbp->disk_array, index, &vpos, &vlen); - cdbp->index = index; - cdbp->vpos = vpos; - cdbp->vlen = vlen; - return 1; -} - -int cdb_read(cdbp *cdb, char* val, cmph_uint32 vlen, cmph_uint64 vpos) { - int c = cmph_disk_array_value(cdb, index, val); - if (c < 0) return -1; - assert(c == vlen); - return vlen; -} diff --git a/cdb/cmph_cdb.h b/cdb/cmph_cdb.h deleted file mode 100644 index fdba870..0000000 --- a/cdb/cmph_cdb.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef __CMPH_CDB_H__ -#define __CMPH_CDB_H__ - -#ifdef __cplusplus -extern "C" -{ -#endif - -typedef struct __cdb_t cdb; -typedef struct __cdb_make_t cdb_make; - -int cdb_init(cdb *cdbp, int fd); -void cdb_free(cdb *cdbp); -int cdb_read(const cdb *cdbp, void *buf, cmph_uint32 len, cmph_uint32 pos); -int cdb_find(const cdb *cdbp, const void *key, cmph_uint32 keylen); -int cdb_read(const cdb *cdbp, void *buf, cmph_uint32 len, cmph_uint32 pos); - -int cdb_make_start(cdb_make *cdbmp, int fd); -int cdb_make_add(cdb_make *cdbmp, const void *key, cmph_uint32 keylen, const void *val, cmph_uint32 vallen); -int cdb_make_finish(cdb_make *cdbmp); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/cdb/cmph_cdb_make.cc b/cdb/cmph_cdb_make.cc deleted file mode 100644 index ead0673..0000000 --- a/cdb/cmph_cdb_make.cc +++ /dev/null @@ -1,31 +0,0 @@ -#include "cmph_cdb.h" - -int cdb_make_start(cdb_make* cdbmp, int fd) { - cdbmp->config = cmph_config_new(key_source); - cdbmp->tmpfd = fd; -} - -int cdb_make_add(cdb_make* cdbmp, const void* key, cmph_uint32 klen, const void *val, cmph_uint32 vlen) { - /* Uses cdb format as documented at http://cr.yp.to/cdb/cdbmake.html. A 32 bits integer takes at most 11 bytes when represented as a string. Adding the plus sign, the comma, the colon and the zero terminator, a total of 25 bytes is required. We use 50. */ - char preamble[50]; - cmph_uint64 c = snprintf(preamble, 25, "+%u,%u:", klen, vlen); - c += write(cdbmp->fd, preamble); - c += write(cdbmp->fd, key); - c += write(cdbmp->fd, ","); - c += write(cdbmp->fd, value); - c += write(cdbmp->fd, "\n"); - if (c != strlen(preamble) + strlen(key) + strlen(value) + 2) return -1; -} - -int cdb_make_finish(cdb_make *cdbmp) { - cmph_io_adapter_t *key_source = cmph_io_cdb_adapter(cdbmp->fd, cdbmp->nkeys); - if (!key_source) return -1; - cmph_config_t *config = cmph_config_new(key_source); - if (!config) return -1; - cmph_t* mphf = cmph_new(config); - if (!mphf) return -1; - FILE *f = fdopen(cdbmp->fd); - if (!f) return -1; - int c = cmph_dump(mphf, f); - if (c < 0) return -1; -} diff --git a/cdb/cmph_cdb_structs.h b/cdb/cmph_cdb_structs.h deleted file mode 100644 index 34ee639..0000000 --- a/cdb/cmph_cdb_structs.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef __CMPH_CDB_STRUCTS_H__ -#define __CMPH_CDB_STRUCTS_H__ - -struct __cmph_cdb_t -{ - cmph_t *mph; - cmph_uint32 *idx; - FILE* data; - cmph_uint64 mmap_data_len; - void* mmap_data; -}; - -struct __cmph_cdb_make_t { - cmph_config_t* config; - - -#endif diff --git a/portage/dev-libs/cmph/cmph-0.9.ebuild b/portage/dev-libs/cmph/cmph-0.9.ebuild index b629593..6b32ca7 100644 --- a/portage/dev-libs/cmph/cmph-0.9.ebuild +++ b/portage/dev-libs/cmph/cmph-0.9.ebuild @@ -5,6 +5,15 @@ LICENSE="LGPL-2" SLOT="0" KEYWORDS="~x86" IUSE="" +DEPEND="gcc libtool libc" +RDEPEND="libc" + +S=${WORKDIR}/${P} + +src_compile() { + econf || die "econf failed" + emake || die "emake failed" +} src_install() { emake DESTDIR=${D} install || die