summaryrefslogtreecommitdiffstats
path: root/src/rccdb4.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2005-07-14 19:39:08 +0000
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2005-07-14 19:39:08 +0000
commit7a6b6a56dabe1e62a0fbc6222c090aa077bcadc7 (patch)
tree1b509a460c238dc6a69c82930a9f726ee0a969e0 /src/rccdb4.c
parent3e5322512be81527430059b901747df7692a6855 (diff)
downloadlibrcc-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.c5
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;