diff options
author | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2005-07-14 19:39:08 +0000 |
---|---|---|
committer | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2005-07-14 19:39:08 +0000 |
commit | 7a6b6a56dabe1e62a0fbc6222c090aa077bcadc7 (patch) | |
tree | 1b509a460c238dc6a69c82930a9f726ee0a969e0 /src/rccdb4.c | |
parent | 3e5322512be81527430059b901747df7692a6855 (diff) | |
download | librcc-7a6b6a56dabe1e62a0fbc6222c090aa077bcadc7.tar.gz librcc-7a6b6a56dabe1e62a0fbc6222c090aa077bcadc7.tar.bz2 librcc-7a6b6a56dabe1e62a0fbc6222c090aa077bcadc7.tar.xz librcc-7a6b6a56dabe1e62a0fbc6222c090aa077bcadc7.zip |
Example
Diffstat (limited to 'src/rccdb4.c')
-rw-r--r-- | src/rccdb4.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/rccdb4.c b/src/rccdb4.c index 5e0894a..fc821a8 100644 --- a/src/rccdb4.c +++ b/src/rccdb4.c @@ -4,7 +4,6 @@ #include "rccdb4.h" #define DATABASE "autolearn.db" -#define MIN_CHARS 3 int rccInitDb4(rcc_context ctx, const char *name, rcc_db4_flags flags) { size_t size; @@ -98,7 +97,7 @@ int rccDb4SetKey(db4_context ctx, const char *orig, size_t olen, const rcc_strin data.data = (char*)string; data.size = strlen(string)+1; - if (key.size < MIN_CHARS) return -1; + if (key.size < RCC_MIN_DB4_CHARS) return -1; err = ctx->db->put(ctx->db, NULL, &key, &data, 0); return err; @@ -117,6 +116,8 @@ rcc_string rccDb4GetKey(db4_context ctx, const char *orig, size_t olen) { key.size = STRNLEN(orig, olen); /* No ending zero */ data.flags = DB_DBT_REALLOC; + + if (key.size < RCC_MIN_DB4_CHARS) return NULL; err = ctx->db->get(ctx->db, NULL, &key, &data, 0); if (err) return NULL; |