summaryrefslogtreecommitdiff
path: root/include/mupdf/fitz/hash.h
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2013-06-17 22:02:22 +0200
committerTor Andersson <tor.andersson@artifex.com>2013-06-18 17:37:13 +0200
commit19126babc37ac8243de60b3ca388bb5102661274 (patch)
treeedcec3f87b5024b6deb6843ca757bbfda81fe44a /include/mupdf/fitz/hash.h
parentcfc58fef94e63dc5a42979e3a9bf806d104462c5 (diff)
downloadmupdf-19126babc37ac8243de60b3ca388bb5102661274.tar.xz
Split fitz.h into subheaders.
Diffstat (limited to 'include/mupdf/fitz/hash.h')
-rw-r--r--include/mupdf/fitz/hash.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/include/mupdf/fitz/hash.h b/include/mupdf/fitz/hash.h
new file mode 100644
index 00000000..f0461e8a
--- /dev/null
+++ b/include/mupdf/fitz/hash.h
@@ -0,0 +1,29 @@
+#ifndef MUPDF_FITZ_HASH_H
+#define MUPDF_FITZ_HASH_H
+
+/*
+ * Generic hash-table with fixed-length keys.
+ */
+
+typedef struct fz_hash_table_s fz_hash_table;
+
+fz_hash_table *fz_new_hash_table(fz_context *ctx, int initialsize, int keylen, int lock);
+void fz_empty_hash(fz_context *ctx, fz_hash_table *table);
+void fz_free_hash(fz_context *ctx, fz_hash_table *table);
+
+void *fz_hash_find(fz_context *ctx, fz_hash_table *table, void *key);
+void *fz_hash_insert(fz_context *ctx, fz_hash_table *table, void *key, void *val);
+void *fz_hash_insert_with_pos(fz_context *ctx, fz_hash_table *table, void *key, void *val, unsigned *pos);
+void fz_hash_remove(fz_context *ctx, fz_hash_table *table, void *key);
+void fz_hash_remove_fast(fz_context *ctx, fz_hash_table *table, void *key, unsigned pos);
+
+int fz_hash_len(fz_context *ctx, fz_hash_table *table);
+void *fz_hash_get_key(fz_context *ctx, fz_hash_table *table, int idx);
+void *fz_hash_get_val(fz_context *ctx, fz_hash_table *table, int idx);
+
+#ifndef NDEBUG
+void fz_print_hash(fz_context *ctx, FILE *out, fz_hash_table *table);
+void fz_print_hash_details(fz_context *ctx, FILE *out, fz_hash_table *table, void (*details)(FILE *, void *));
+#endif
+
+#endif