Commit Graph

21 Commits

Author SHA1 Message Date
Patrick Steinhardt
f31cb45ad2 khash: avoid using kh_put directly 2017-02-17 11:41:06 +01:00
Patrick Steinhardt
71a54317ef khash: avoid using kh_key directly 2017-02-17 11:41:06 +01:00
Patrick Steinhardt
cb18386f72 khash: avoid using kh_val/kh_value directly 2017-02-17 11:41:06 +01:00
Edward Thomson
909d549436 giterr_set: consistent error messages
Error messages should be sentence fragments, and therefore:

1. Should not begin with a capital letter,
2. Should not conclude with punctuation, and
3. Should not end a sentence and begin a new one
2016-12-29 12:26:03 +00:00
Patrick Steinhardt
24b2182c5a sortedcache: plug leaked file descriptor 2016-11-15 12:53:53 +01:00
Carlos Martín Nieto
40ffa07f4f sortedcache: check file size after opening the file
Checking the size before we open the file descriptor can lead to the
file being replaced from under us when renames aren't quite atomic, so
we can end up reading too little of the file, leading to us thinking the
file is corrupted.
2016-11-14 11:35:38 +01:00
Vicent Marti
1e5e02b4f4 pool: Simplify implementation 2015-10-28 10:13:13 +01:00
Stefan Widgren
c8e02b8776 Remove extra semicolon outside of a function
Without this change, compiling with gcc and pedantic generates warning:
ISO C does not allow extra ‘;’ outside of a function.
2015-02-15 21:07:05 +01:00
Edward Thomson
f1453c59b2 Make our overflow check look more like gcc/clang's
Make our overflow checking look more like gcc and clang's, so that
we can substitute it out with the compiler instrinsics on platforms
that support it.  This means dropping the ability to pass `NULL` as
an out parameter.

As a result, the macros also get updated to reflect this as well.
2015-02-13 09:27:33 -05:00
Edward Thomson
392702ee2c allocations: test for overflow of requested size
Introduce some helper macros to test integer overflow from arithmetic
and set error message appropriately.
2015-02-12 22:54:46 -05:00
Russell Belfer
7d4908724f Attribute file cache refactor
This is a big refactoring of the attribute file cache to be a bit
simpler which in turn makes it easier to enforce a lock around any
updates to the cache so that it can be used in a threaded env.
Tons of changes to the attributes and ignores code.
2014-04-17 14:56:41 -07:00
Russell Belfer
40ed499039 Add diff threading tests and attr file cache locks
This adds a basic test of doing simultaneous diffs on multiple
threads and adds basic locking for the attr file cache because
that was the immediate problem that arose from these tests.
2014-04-17 14:43:45 -07:00
Russell Belfer
882c774271 Convert pqueue to just be a git_vector
This updates the git_pqueue to simply be a set of specialized
init/insert/pop functions on a git_vector.

To preserve the pqueue feature of having a fixed size heap, I
converted the "sorted" field in git_vectors to a more general
"flags" field so that pqueue could mix in it's own flag.  This
had a bunch of ramifications because a number of places were
directly looking at the vector "sorted" field - I added a couple
new git_vector helpers (is_sorted, set_sorted) so the specific
representation of this information could be abstracted.
2014-02-04 10:01:37 -08:00
Russell Belfer
805755f49b Fix sortedcache docs and other feedback
This converts an internal lock from a write lock to a read lock
where write isn't needed, and also clarifies some doc things about
where various locks are acquired and how various APIs are intended
to be used.
2013-08-22 15:44:34 -07:00
Russell Belfer
b6ac07b517 Trying to fix Win32 warnings 2013-08-22 14:45:10 -07:00
Russell Belfer
2b6e190847 A bit of item alignment paranoia 2013-08-22 11:50:10 -07:00
Russell Belfer
8d9a85d43a Convert sortedcache to use rwlock
This is the first use we have of pthread_rwlock_t in libgit2.
Hopefully it won't cause any serious portability problems.
2013-08-22 11:40:53 -07:00
Russell Belfer
e8c5eb5537 No need to lock newly created tgt in copy 2013-08-21 22:44:56 -07:00
Russell Belfer
b37359aac5 Fix warnings when compiling without threads 2013-08-21 16:50:03 -07:00
Russell Belfer
a4977169e1 Add sortedcache APIs to lookup index and remove
This adds two other APIs that I need to the sortedcache type.
2013-08-21 14:09:38 -07:00
Russell Belfer
0b7cdc0263 Add sorted cache data type
This adds a convenient new data type for caching the contents of
file in memory when each item in that file corresponds to a name
and you need to both be able to lookup items by name and iterate
over them in some sorted order.  The new data type has locks in
place to manage usage in a threaded environment.
2013-08-20 16:14:24 -07:00