mirror of
https://github.com/git/git.git
synced 2024-11-18 06:54:55 +01:00
1d73b52f5b
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>
11 lines
381 B
C
11 lines
381 B
C
#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
|