summaryrefslogtreecommitdiffstats
path: root/squarkdb.h
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2010-08-13 10:17:31 +0300
committerTimo Teräs <timo.teras@iki.fi>2010-08-13 10:17:31 +0300
commit8bc76c78a69360efc7a07a3c4e92f393cca22543 (patch)
tree447d60cf98355698ef9d6ad2480550b0d71ed266 /squarkdb.h
parente0a013397a51963039c43877be3afe954e519be0 (diff)
downloadsquark-8bc76c78a69360efc7a07a3c4e92f393cca22543.tar.bz2
squark-8bc76c78a69360efc7a07a3c4e92f393cca22543.tar.xz
db: smarter string pointer encoding (include length field)
So we don't need explicit null terminator in most cases saving space. It will also speed up comparisons as getting string blob is now constant time (no strlen needed).
Diffstat (limited to 'squarkdb.h')
-rw-r--r--squarkdb.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/squarkdb.h b/squarkdb.h
index 3733ec1..743325e 100644
--- a/squarkdb.h
+++ b/squarkdb.h
@@ -3,6 +3,9 @@
#include <stddef.h>
#include <stdint.h>
+#include "blob.h"
+
+#define SQDB_LENGTH_BITS 5
#define SQDB_SECTION_STRINGS 0
#define SQDB_SECTION_CATEGORIES 1
@@ -39,6 +42,7 @@ struct sqdb_index_entry {
uint32_t component;
};
+
const char *sqdb_section_names[SQDB_SECTION_MAX];
int sqdb_create(struct sqdb *db, const char *fn);
@@ -47,5 +51,6 @@ void sqdb_close(struct sqdb *db);
void *sqdb_section_create(struct sqdb *db, int id, uint32_t size);
void *sqdb_section_get(struct sqdb *db, int id, uint32_t *size);
+blob_t sqdb_get_string_literal(struct sqdb *db, uint32_t encoded_ptr);
#endif