PerfectHash 0.1.1 → 0.1.2
raw patch · 2 files changed
+8/−14 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- PerfectHash.cabal +1/−1
- stub.c +7/−13
PerfectHash.cabal view
@@ -1,5 +1,5 @@ Name: PerfectHash-Version: 0.1.1+Version: 0.1.2 Cabal-Version: >= 1.2 License: BSD3 License-File: LICENSE
stub.c view
@@ -3,26 +3,20 @@ #include <string.h> #include <cmph.h> -// #define __MONKEY_DEBUG__--void monkey_debug(char ** vector, int nkeys) {- int i = 0;- int blah=0;- for(i=0; i< nkeys; i++) {- fprintf(stderr, "read:%5d: %s\n", i, vector[i]); - }-}+/* alas, BDZ is not defined in 0.7, so we need a fallback */+#ifdef CMPH_BDZ+#define CMPH_ALGO CMPH_BDZ+#else+#define CMPH_ALGO CMPH_BMZ+#endif cmph_t * build_hash(char ** vector, int nkeys) {-#ifdef __MONKEY_DEBUG__- monkey_debug(vector, nkeys);-#endif // fprintf(stderr, "building hash with %d keys, first is %s, last is %s\n", nkeys, *vector, vector[nkeys-1]); cmph_io_adapter_t *source = cmph_io_vector_adapter(vector, nkeys); //fprintf(stderr, "building adapter is %p\n", source); cmph_config_t *config = cmph_config_new(source); // fprintf(stderr, "building config is %p\n", config);- cmph_config_set_algo(config, CMPH_BDZ);+ cmph_config_set_algo(config, CMPH_ALGO); cmph_t *hash = cmph_new(config); // cmph_config_destroy(config); // fprintf(stderr, "building hash is %p\n", hash);