diff options
author | David Barr <david.barr@cordelta.com> | 2010-08-09 17:34:42 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-08-14 19:35:37 -0700 |
commit | 1d73b52f5ba4184de6acf474f14668001304a10c (patch) | |
tree | eab339299282709e45101c011ba57b565278a18e /vcs-svn/string_pool.h | |
parent | 951f316470acc7c785c460a4e40735b22822349f (diff) | |
download | git-1d73b52f5ba4184de6acf474f14668001304a10c.tar.gz |
Add string-specific memory pool
Intern strings so they can be compared by address and stored without
wasting space.
This library uses the macros in the obj_pool.h and trp.h to create a
memory pool for strings and expose an API for handling them.
[rr: added API docs]
[jn: with some API simplifications, new documentation and tests]
Signed-off-by: David Barr <david.barr@cordelta.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'vcs-svn/string_pool.h')
-rw-r--r-- | vcs-svn/string_pool.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/vcs-svn/string_pool.h b/vcs-svn/string_pool.h new file mode 100644 index 0000000000..222fb66e68 --- /dev/null +++ b/vcs-svn/string_pool.h @@ -0,0 +1,11 @@ +#ifndef STRING_POOL_H_ +#define STRING_POOL_H_ + +uint32_t pool_intern(const char *key); +const char *pool_fetch(uint32_t entry); +uint32_t pool_tok_r(char *str, const char *delim, char **saveptr); +void pool_print_seq(uint32_t len, uint32_t *seq, char delim, FILE *stream); +uint32_t pool_tok_seq(uint32_t sz, uint32_t *seq, const char *delim, char *str); +void pool_reset(void); + +#endif |