summaryrefslogtreecommitdiff
path: root/src/util.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #1858 from linquize/win32-template-dirVicent Martí2013-09-171-0/+13
|\ | | | | Configurable template dir for Win32
| * Can git_libgit2_opts() with GIT_OPT_GET_TEMPLATE_PATH and ↵Linquize2013-09-181-0/+13
| | | | | | | | GIT_OPT_SET_TEMPLATE_PATH
* | Merge git_buf and git_bufferRussell Belfer2013-09-171-0/+3
|/ | | | | | | | | | | This makes the git_buf struct that was used internally into an externally available structure and eliminates the git_buffer. As part of that, some of the special cases that arose with the externally used git_buffer were blended into the git_buf, such as being careful about git_buf objects that may have a NULL ptr and allowing for bufs with a valid ptr and size but zero asize as a way of referring to externally owned data.
* Use git__insertsort_r on Android too.Krzysztof Adamski2013-09-011-1/+1
|
* Add GIT_CAP_SSH if library was built with SSHRussell Belfer2013-07-091-0/+3
| | | | | This also adds a test that actually calls git_libgit2_capabilities and git_libgit2_version.
* Fix some warningsRussell Belfer2013-06-171-9/+6
|
* git__strcasesort_cmp: strcasecmp sorting rules but requires strict equalityEdward Thomson2013-06-171-0/+25
|
* util: git__memzero() tweaksyorah2013-06-171-9/+0
| | | | | | | On Linux: fix a warning message related to the volatile qualifier (cast) On Windows: use SecureZeroMemory() On both, inline the call, so that no entry point can lead back to this "secure" memory zeroing.
* util: It's called `memzero`Vicent Marti2013-06-121-3/+2
|
* Add safe memset and use itRussell Belfer2013-06-071-0/+10
| | | | | | This adds a `git__memset` routine that will not be optimized away and updates the places where I memset() right before a free() call to use it.
* qsort_r appeared in glibc 2.8Edward Thomson2013-05-251-1/+2
|
* qsort_r is broken on HURD, avoidEdward Thomson2013-05-241-1/+2
|
* Fixed qsort_r() problem when targeting AmigaOS.Sebastian Bauer2013-05-071-1/+1
| | | | | We fall back to the libgit2-provided insert sort as done for other platforms.
* git_atomic_ssize for 64-bit atomics only on 64-bit platformsEdward Thomson2013-04-251-3/+3
|
* opts: Add getter for cached memoryvmg/atomic64Vicent Marti2013-04-231-0/+5
|
* cache: Shared meter for memory usageVicent Marti2013-04-221-2/+1
|
* cache: Max cache size, and evict when the cache fills upvmg/new-cacheVicent Marti2013-04-221-1/+5
|
* Add range checking around cache optsRussell Belfer2013-04-221-3/+5
| | | | | | | Add a git_cache_set_max_object_size method that does more checking around setting the max object size. Also add a git_cache_size to read the number of objects currently in the cache. This makes it easier to write tests.
* Global option settersVicent Marti2013-04-221-0/+11
|
* lol this worked first try wtfVicent Marti2013-04-221-8/+0
|
* Fix compilation on OpenBSDCarlos Martín Nieto2013-04-151-1/+1
|
* opts: allow configuration of odb cache sizeMichael Schubert2013-03-251-0/+9
| | | | | | | | Currently, the odb cache has a fixed size of 128 slots as defined by GIT_DEFAULT_CACHE_SIZE. Allow users to set the size of the cache via git_libgit2_opts(). Fixes #1035.
* Fixes and cleanupsRussell Belfer2013-03-181-53/+7
| | | | | Get rid of some dead code, tighten things up a bit, and fix a bug with core::env test.
* Switch search paths to classic delimited stringsRussell Belfer2013-03-181-15/+9
| | | | | | | | | | | | This switches the APIs for setting and getting the global/system search paths from using git_strarray to using a simple string with GIT_PATH_LIST_SEPARATOR delimited paths, just as the environment PATH variable would contain. This makes it simpler to get and set the value. I also added code to expand "$PATH" when setting a new value to embed the old value of the path. This means that I no longer require separate actions to PREPEND to the value.
* Implement global/system file search pathsRussell Belfer2013-03-151-8/+98
| | | | | | | | | | | | | | | | | | | | | | | The goal of this work is to expose the search logic for "global", "system", and "xdg" files through the git_libgit2_opts() interface. Behind the scenes, I changed the logic for finding files to have a notion of a git_strarray that represents a search path and to store a separate search path for each of the three tiers of config file. For each tier, I implemented a function to initialize it to default values (generally based on environment variables), and then general interfaces to get it, set it, reset it, and prepend new directories to it. Next, I exposed these interfaces through the git_libgit2_opts interface, reusing the GIT_CONFIG_LEVEL_SYSTEM, etc., constants for the user to control which search path they were modifying. There are alternative designs for the opts interface / argument ordering, so I'm putting this phase out for discussion. Additionally, I ended up doing a little bit of clean up regarding attr.h and attr_file.h, adding a new attrcache.h so the other two files wouldn't have to be included in so many places.
* MSVC: What could possibly be the size of a void*?Vicent Marti2013-03-121-1/+2
|
* Sorting function cleanup and MinGW fixRussell Belfer2013-03-111-6/+28
| | | | | | | Clean up some sorting function stuff including fixing qsort_r on MinGW, common function pointer type for comparison, and basic insertion sort implementation (which we, regrettably, fall back on for MinGW).
* Make tree iterator handle icase equivalenceRussell Belfer2013-03-081-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | There is a serious bug in the previous tree iterator implementation. If case insensitivity resulted in member elements being equivalent to one another, and those member elements were trees, then the children of the colliding elements would be processed in sequence instead of in a single flattened list. This meant that the tree iterator was not truly acting like a case-insensitive list. This completely reworks the tree iterator to manage lists with case insensitive equivalence classes and advance through the items in a unified manner in a single sorted frame. It is possible that at a future date we might want to update this to separate the case insensitive and case sensitive tree iterators so that the case sensitive one could be a minimal amount of code and the insensitive one would always know what it needed to do without checking flags. But there would be so much shared code between the two, that I'm not sure it that's a win. For now, this gets what we need. More tests are needed, though.
* Vector improvements and their falloutPhilip Kelley2013-01-271-6/+6
|
* opts: Add getters tooVicent Marti2013-01-231-2/+10
|
* Global options setterVicent Marti2013-01-231-0/+23
|
* Add payload "_r" versions of bsearch and tsortRussell Belfer2013-01-151-1/+32
| | | | | | | | | git__bsearch and git__tsort did not pass a payload through to the comparison function. This makes it impossible to implement sorted lists where the sort order depends on external data (e.g. building a secondary sort order for the entries in a tree). This commit adds git__bsearch_r and git__tsort_r versions that pass a third parameter to the cmp function of a user payload.
* update copyrightsEdward Thomson2013-01-081-1/+1
|
* Add full license notice to bsearch codeMartin Woodward2013-01-031-1/+25
| | | | | | The original BSD glibc code contains the notice as given at http://opensource.apple.com/source/gcc/gcc-5666.3/libiberty/bsearch.c and should be given in full along with the code.
* Fix git__strncasecmpPhilip Kelley2013-01-031-7/+5
|
* fetchhead reading/iteratingEdward Thomson2012-12-191-0/+18
|
* Fix -Wmaybe-uninitialized warningMichael Schubert2012-12-171-1/+1
|
* Fix iterator reset and add reset rangesRussell Belfer2012-12-101-2/+10
| | | | | | | The `git_iterator_reset` command has not been working in all cases particularly when there is a start and end range. This fixes it and adds tests for it, and also extends it with the ability to update the start/end range strings when an iterator is reset.
* Fix up some missing consts in tree & indexRussell Belfer2012-11-271-1/+1
| | | | | | | | | | | | | This fixes some missed places where we can apply const-ness to various public APIs. There are still some index and tree APIs that cannot take const pointers because we sort our `git_vectors` lazily and so we can't reliably bsearch the index and tree content without applying a `git_vector_sort()` first. This also fixes some missed places where size_t can be used and where const can be applied to a couple internal functions.
* Create internal strcmp variants for function ptrsRussell Belfer2012-11-141-0/+30
| | | | | | Using the builtin strcmp and strcasecmp as function pointers is problematic on win32. This adds internal implementations and divorces us from the platform linkage.
* config: distinguish between a lone variable name and one without rhsCarlos Martín Nieto2012-11-131-7/+4
| | | | | | '[section] variable' and '[section] variable =' behave differently when parsed as booleans, so we need to store that distinction internally.
* Support for core.ignorecasePhilip Kelley2012-09-171-0/+5
|
* http: use WinHTTP on WindowsCarlos Martín Nieto2012-09-141-1/+1
| | | | | | | | Wondows has its own HTTP library. Use that one when possible instead of our own. As we don't depend on them anymore, remove the http-parser library from the Windows build, as well as the search for OpenSSL.
* Add function to query for compile time settings.Sascha Cunz2012-08-011-0/+12
|
* Add git_buf_unescape and git__unescape to unescape all characters in a ↵yorah2012-07-241-0/+18
| | | | string (in-place)
* Fix git_status_file for files that start with a character > 0x7f8bit-filename-statusAdam Roben2012-06-071-1/+1
| | | | | | | | | | | | | | | | git_status_file would always return GIT_ENOTFOUND for these files. The underlying bug was that git__strcmp_cb, which is used by git_path_with_stat_cmp to sort entries in the working directory, compares strings based on unsigned chars (this is confirmed by the strcmp(3) manpage), while git__prefixcmp, which is used by workdir_iterator__entry_cmp to search for a path in the working directory, compares strings based on char. So the sort puts this path at the end of the list, while the search expects it to be at the beginning. The fix was simply to make git__prefixcmp compare using unsigned chars, just like strcmp(3). The rest of the change is just adding/updating tests.
* global: Change parameter ordering in APIVicent Martí2012-05-181-0/+24
| | | | Consistency is good.
* msvc: Do not use `isspace` Vicent Martí2012-05-091-1/+1
| | | | Locale-aware bullshit bitting my ass again yo
* Remove old and unused error codesVicent Martí2012-05-021-16/+0
|
* Fix warnings on 64-bit windows buildsRussell Belfer2012-04-171-2/+3
| | | | | This fixes all the warnings on win64 except those in deps, which come from the regex code.