diff options
author | Simon Rettberg | 2017-04-21 16:31:06 +0200 |
---|---|---|
committer | Simon Rettberg | 2017-04-21 16:31:06 +0200 |
commit | b61176f17b59a94750dff1f959231dadc4e6078a (patch) | |
tree | 88ee419323ba332a1dd06c5aa801c87f59b36bb3 /strduptab.h | |
parent | ldadp.h: Add missing SearchRequestReference opcode (diff) | |
download | ldadp-b61176f17b59a94750dff1f959231dadc4e6078a.tar.gz ldadp-b61176f17b59a94750dff1f959231dadc4e6078a.tar.xz ldadp-b61176f17b59a94750dff1f959231dadc4e6078a.zip |
Update ldap/asn1/... files with current tinyldap
Diffstat (limited to 'strduptab.h')
-rw-r--r-- | strduptab.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/strduptab.h b/strduptab.h new file mode 100644 index 0000000..2bbc67c --- /dev/null +++ b/strduptab.h @@ -0,0 +1,13 @@ +/* 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 pointer". Will try to insert the + * string in the table. If the same string was already there, it will + * return a pointer to that string, otherwise it will insert a copy of + * the new string. */ + +struct stringduptable { + size_t n,a; + const char** s; +}; + +const char* strduptab_add(struct stringduptable* t,const char* s); |