summaryrefslogtreecommitdiffstats
path: root/mduptab.h
diff options
context:
space:
mode:
authorSimon Rettberg2017-04-21 16:31:06 +0200
committerSimon Rettberg2017-04-21 16:31:06 +0200
commitb61176f17b59a94750dff1f959231dadc4e6078a (patch)
tree88ee419323ba332a1dd06c5aa801c87f59b36bb3 /mduptab.h
parentldadp.h: Add missing SearchRequestReference opcode (diff)
downloadldadp-b61176f17b59a94750dff1f959231dadc4e6078a.tar.gz
ldadp-b61176f17b59a94750dff1f959231dadc4e6078a.tar.xz
ldadp-b61176f17b59a94750dff1f959231dadc4e6078a.zip
Update ldap/asn1/... files with current tinyldap
Diffstat (limited to 'mduptab.h')
-rw-r--r--mduptab.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/mduptab.h b/mduptab.h
new file mode 100644
index 0000000..5704e87
--- /dev/null
+++ b/mduptab.h
@@ -0,0 +1,19 @@
+/* save memory for constant strings by keeping a list of the ones that
+ * we already saw and not allocating memory for each new one. The only
+ * API is "add string and return offset". The offset is relative to the
+ * root of the pstorage_t. Will try to insert the string in the table.
+ * If the same string was already there, it will return offset of that
+ * string, otherwise it will insert a copy of the new string. */
+
+#include "mstorage.h"
+
+typedef struct mduptable {
+ mstorage_t table,strings;
+ mstorage_t* Strings;
+} mduptab_t;
+
+void mduptab_init(mduptab_t* t);
+void mduptab_init_reuse(mduptab_t* t,mstorage_t* s);
+long mduptab_add(mduptab_t* t,const char* s,size_t len);
+long mduptab_adds(mduptab_t* t,const char* s);
+void mduptab_reset(mduptab_t* t);