summaryrefslogtreecommitdiff
path: root/src/pool.h
Commit message (Collapse)AuthorAgeFilesLines
* Avoid using atomics in pool.clhchavez2020-10-081-0/+8
| | | | Instead, globally initialize the system page size.
* git_pool_init: return an intEdward Thomson2020-05-231-1/+1
| | | | Let `git_pool_init` return an int so that it could fail.
* pool: use `size_t` for sizesEdward Thomson2019-06-241-7/+7
|
* Make sure to always include "common.h" firstPatrick Steinhardt2017-07-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | Next to including several files, our "common.h" header also declares various macros which are then used throughout the project. As such, we have to make sure to always include this file first in all implementation files. Otherwise, we might encounter problems or even silent behavioural differences due to macros or defines not being defined as they should be. So in fact, our header and implementation files should make sure to always include "common.h" first. This commit does so by establishing a common include pattern. Header files inside of "src" will now always include "common.h" as its first other file, separated by a newline from all the other includes to make it stand out as special. There are two cases for the implementation files. If they do have a matching header file, they will always include this one first, leading to "common.h" being transitively included as first file. If they do not have a matching header file, they instead include "common.h" as first file themselves. This fixes the outlined problems and will become our standard practice for header and source files inside of the "src/" from now on.
* pool: provide macro to statically initialize git_poolPatrick Steinhardt2016-08-051-0/+5
|
* Fixed typo in one of the ifndef's in pool.h used to enable/disable debug modeRoss Delinger2016-02-261-1/+1
|
* Remove unnecessary ifdef in pool.hRoss Delinger2016-02-191-3/+0
|
* Add a new build flag to disable the pool allocator and pass all ↵Ross Delinger2016-01-121-0/+31
| | | | git_pool_malloc calls straight to git__malloc
* pool: fix documentationEdward Thomson2015-10-281-2/+2
|
* pool: update commentVicent Marti2015-10-281-1/+1
|
* pool: Dot not assume mallocs are zeroed outVicent Marti2015-10-281-12/+1
|
* pool: Simplify implementationVicent Marti2015-10-281-35/+2
|
* Fix compiler warning (git_off_t cast to size_t).Albert Meltzer2014-05-191-2/+0
| | | | | | Use size_t for page size, instead of long. Check result of sysconf. Use size_t for page offset so no cast to size_t (second arg to p_mmap). Use mod instead div/mult pair, so no cast to size_t is necessary.
* Improved tree iterator internalsRussell Belfer2013-03-141-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | This updates the tree iterator internals to be more efficient. The tree_iterator_entry objects are now kept as pointers that are allocated from a git_pool, so that we may use git__tsort_r for sorting (which is better than qsort, given that the tree is likely mostly ordered already). Those tree_iterator_entry objects now keep direct pointers to the data they refer to instead of keeping indirect index values. This simplifies a lot of the data structure traversal code. This also adds bsearch to find the start item position for range- limited tree iterators, and is more explicit about using git_path_cmp instead of reimplementing it. The git_path_cmp changed a bit to make it easier for tree_iterators to use it (but it was barely being used previously, so not a big deal). This adds a git_pool_free_array function that efficiently frees a list of pool allocated pointers (which the tree_iterator keeps). Also, added new tests for the git_pool free list functionality that was not previously being tested (or used).
* update copyrightsEdward Thomson2013-01-081-1/+1
|
* Diff iteratorsRussell Belfer2012-09-051-0/+11
| | | | | | | | | | | This refactors the diff output code so that an iterator object can be used to traverse and generate the diffs, instead of just the `foreach()` style with callbacks. The code has been rearranged so that the two styles can still share most functions. This also replaces `GIT_REVWALKOVER` with `GIT_ITEROVER` and uses that as a common error code for marking the end of iteration when using a iterator style of object.
* Fix bug with merging diffs with null optionsRussell Belfer2012-07-191-0/+7
| | | | | | | A diff that is created with a NULL options parameter could result in a NULL prefix string, but diff merge was unconditionally strdup'ing it. I added a test to replicate the issue and then a new method that does the right thing with NULL values.
* Convert revwalk to use git_poolRussell Belfer2012-04-251-0/+2
| | | | | This removes the custom paged allocator from revwalk and replaces it with a `git_pool`.
* Convert attrs and diffs to use string poolsRussell Belfer2012-04-251-2/+17
| | | | | | | 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.
* Implement git_pool paged memory allocatorRussell Belfer2012-04-251-0/+108
This adds a `git_pool` object that can do simple paged memory allocation with free for the entire pool at once. Using this, you can replace many small allocations with large blocks that can then cheaply be doled out in small pieces. This is best used when you plan to free the small blocks all at once - for example, if they represent the parsed state from a file or data stream that are either all kept or all discarded. There are two real patterns of usage for `git_pools`: either for "string" allocation, where the item size is a single byte and you end up just packing the allocations in together, or for "fixed size" allocation where you are allocating a large object (e.g. a `git_oid`) and you generally just allocation single objects that can be tightly packed. Of course, you can use it for other things, but those two cases are the easiest.