diff options
| author | Russell Belfer <rb@github.com> | 2012-04-17 15:12:50 -0700 |
|---|---|---|
| committer | Russell Belfer <rb@github.com> | 2012-04-25 10:42:37 -0700 |
| commit | 19fa2bc111d50dc2bafb1393b87b5ba119615ae2 (patch) | |
| tree | 103a62cf49834958b18562f411abd18b2a438ce6 /src/attr_file.h | |
| parent | 2bc8fa0227d549006a9870620ca1f2e08a0c305e (diff) | |
| download | libgit2-19fa2bc111d50dc2bafb1393b87b5ba119615ae2.tar.gz | |
Convert attrs and diffs to use string pools
This converts the git attr related code (including ignores) and
the git diff related code (and implicitly the status code) to use
`git_pools` for storing strings. This reduces the number of small
blocks allocated dramatically.
Diffstat (limited to 'src/attr_file.h')
| -rw-r--r-- | src/attr_file.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/attr_file.h b/src/attr_file.h index 294033d5e..9788a2295 100644 --- a/src/attr_file.h +++ b/src/attr_file.h @@ -10,6 +10,7 @@ #include "git2/attr.h" #include "vector.h" #include "hashtable.h" +#include "pool.h" #define GIT_ATTR_FILE ".gitattributes" #define GIT_ATTR_FILE_INREPO "info/attributes" @@ -36,20 +37,21 @@ typedef struct { typedef struct { git_refcount unused; const char *name; - unsigned long name_hash; + uint32_t name_hash; } git_attr_name; typedef struct { git_refcount rc; /* for macros */ char *name; - unsigned long name_hash; + uint32_t name_hash; const char *value; - int is_allocated; } git_attr_assignment; typedef struct { char *path; /* cache the path this was loaded from */ git_vector rules; /* vector of <rule*> or <fnmatch*> */ + git_pool *pool; + bool pool_is_allocated; } git_attr_file; typedef struct { @@ -62,7 +64,7 @@ typedef struct { * git_attr_file API */ -extern int git_attr_file__new(git_attr_file **attrs_ptr); +extern int git_attr_file__new(git_attr_file **attrs_ptr, git_pool *pool); extern void git_attr_file__free(git_attr_file *file); extern int git_attr_file__from_buffer( @@ -84,7 +86,7 @@ extern int git_attr_file__lookup_one( git_vector_rforeach(&(file)->rules, (iter), (rule)) \ if (git_attr_rule__match((rule), (path))) -extern unsigned long git_attr_file__name_hash(const char *name); +extern uint32_t git_attr_file__name_hash(const char *name); /* @@ -93,6 +95,7 @@ extern unsigned long git_attr_file__name_hash(const char *name); extern int git_attr_fnmatch__parse( git_attr_fnmatch *spec, + git_pool *pool, const char *source, const char **base); @@ -114,6 +117,7 @@ extern int git_attr_path__init( extern int git_attr_assignment__parse( git_repository *repo, /* needed to expand macros */ + git_pool *pool, git_vector *assigns, const char **scan); |
