crashes with number of keys=0
Brought to you by:
davi,
fc_botelho
#include <stdio.h>
#include <string.h>
#include <cmph.h>
int main() {
char * str = "foo";
char ** vector = &str;
int nkeys = 0;
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_t *hash = cmph_new(config);
fprintf(stderr, "building hash is %p\n", hash);
if(!hash) { fprintf(stderr, "Dying horribly, hash is null"); exit(1); }
}
works fine with nkeys=1. obviously in the normal case you're not going to deliberately create a zero-length hash, but with pervasive hashing this bit me.