summaryrefslogtreecommitdiff
path: root/src/common.h
Commit message (Collapse)AuthorAgeFilesLines
* centralizing all IO buffer size valuesJ Wyman2015-05-111-0/+5
|
* Include ws2tcpip.h in order to get in6_addrAki Koskinen2015-03-021-0/+1
| | | | It's currently required in src/openssl_stream.c only.
* integer overflow: use compiler intrinsics if supportedEdward Thomson2015-02-131-0/+5
| | | | | gcc and clang support __builtin_add_overflow, use it whenever possible, falling back to our naive routines.
* Make our overflow check look more like gcc/clang'sEdward Thomson2015-02-131-10/+10
| | | | | | | | | 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.
* Introduce git__add_sizet_overflow and friendsEdward Thomson2015-02-121-2/+4
| | | | | Add some helper functions to check for overflow in a type-specific manner.
* overflow checking: don't make callers set oomEdward Thomson2015-02-121-10/+4
| | | | | | Have the ALLOC_OVERFLOW testing macros also simply set_oom in the case where a computation would overflow, so that callers don't need to.
* allocations: test for overflow of requested sizeEdward Thomson2015-02-121-0/+22
| | | | | Introduce some helper macros to test integer overflow from arithmetic and set error message appropriately.
* bswap: remove unused bswapEdward Thomson2015-02-031-1/+0
|
* Spelling fixesWill Stamper2014-12-041-1/+1
|
* Make init_options fns use unsigned ints and macroRussell Belfer2014-05-021-0/+5
| | | | | Use an unsigned int for the version and add a helper macro so the code is simplified (and so the error message is a common string).
* strcasecmp is in <strings.h>Jacques Germishuys2014-04-301-0/+1
|
* Index locking and entry allocation changesRussell Belfer2014-04-171-0/+1
| | | | | | | | | | | | | | | | | This makes the lock management on the index a little bit broader, having a number of routines hold the lock across looking up the item to be modified and actually making the modification. Still not true thread safety, but more pure index modifications are now safe which allows the simple cases (such as starting up a diff while index modifications are underway) safe enough to get the snapshot without hitting allocation problems. As part of this, I simplified the allocation of index entries to use a flex array and just put the path at the end of the index entry. This makes every entry self-contained and makes it a little easier to feel sure that pointers to strings aren't being accidentally copied and freed while other references are still being held.
* Address PR commentsRussell Belfer2014-02-201-0/+7
| | | | | | | * Make GIT_INLINE an internal definition so it cannot be used in public headers * Fix language in CONTRIBUTING * Make index caps API use signed instead of unsigned values
* One more rename/cleanup for callback err functionsRussell Belfer2013-12-111-3/+6
|
* Fix C99 __func__ for MSVCRussell Belfer2013-12-111-0/+4
|
* Remove converting user error to GIT_EUSERRussell Belfer2013-12-111-10/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the behavior of callbacks so that the callback error code is not converted into GIT_EUSER and instead we propagate the return value through to the caller. Instead of using the giterr_capture and giterr_restore functions, we now rely on all functions to pass back the return value from a callback. To avoid having a return value with no error message, the user can call the public giterr_set_str or some such function to set an error message. There is a new helper 'giterr_set_callback' that functions can invoke after making a callback which ensures that some error message was set in case the callback did not set one. In places where the sign of the callback return value is meaningful (e.g. positive to skip, negative to abort), only the negative values are returned back to the caller, obviously, since the other values allow for continuing the loop. The hardest parts of this were in the checkout code where positive return values were overloaded as meaningful values for checkout. I fixed this by adding an output parameter to many of the internal checkout functions and removing the overload. This added some code, but it is probably a better implementation. There is some funkiness in the network code where user provided callbacks could be returning a positive or a negative value and we want to rely on that to cancel the loop. There are still a couple places where an user error might get turned into GIT_EUSER there, I think, though none exercised by the tests.
* Improve GIT_EUSER handlingRussell Belfer2013-12-111-14/+28
| | | | | | | | | | | This adds giterr_user_cancel to return GIT_EUSER and clear any error message that is sitting around. As a result of using that in places, we need to be more thorough with capturing errors that happen inside a callback when used internally. To help with that, this also adds giterr_capture and giterr_restore so that when we internally use a foreach-type function that clears errors and converts them to GIT_EUSER, it is easier to restore not just the return value, but the actual error message text.
* Clean up warningsEdward Thomson2013-12-091-0/+2
|
* preserve windows error numbers as wellEdward Thomson2013-11-011-0/+24
|
* Add git_has_win32_version helperPhilip Kelley2013-03-311-1/+2
|
* Implement global/system file search pathsRussell Belfer2013-03-151-0/+6
| | | | | | | | | | | | | | | | | | | | | | | 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.
* Fix some deprecation warnings on WindowsRussell Belfer2013-02-281-3/+1
| | | | | This fixes some snprintf and vsnprintf related deprecation warnings we've been having on Windows with recent compilers.
* Add GIT_STDLIB_CALLRussell Belfer2013-02-281-0/+2
| | | | | | This removes the one-off GIT_CDECL and adds a new standard way of doing this named GIT_STDLIB_CALL with a src/win32 specific def when on the Windows platform.
* Deduplicate FormatMessage UTF-16 to UTF-8 conversion codeSven Strickroth2013-02-021-0/+1
| | | | Signed-off-by: Sven Strickroth <email@cs-ware.de>
* update copyrightsEdward Thomson2013-01-081-1/+1
|
* versions: MSVC build fixesVicent Marti2012-12-051-5/+5
|
* common: Silly vmg.Vicent Marti2012-12-051-1/+2
|
* common: Silly MSVCVicent Marti2012-12-051-1/+2
|
* Merge pull request #1115 from ben/struct-versionsVicent Martí2012-12-051-0/+27
|\ | | | | Version info for public structs
| * Don't unconstify when castingBen Straub2012-12-031-1/+1
| |
| * Deploy GIT_INIT_STRUCTUREBen Straub2012-11-301-0/+10
| |
| * Deploy GITERR_CHECK_VERSIONBen Straub2012-11-301-0/+17
| |
* | revparse: Deploy EINVALIDSPEC usagenulltoken2012-12-011-2/+2
|/
* Reorganize transport architecture (squashed 3)Philip Kelley2012-11-011-3/+0
|
* Make giterr_set_str publicRussell Belfer2012-09-211-3/+13
| | | | | | | There has been discussion for a while about making some set of the `giterr_set` type functions part of the public API for code that is implementing new backends to libgit2. This makes the `giterr_set_str()` and `giterr_set_oom()` functions public.
* remote: start moving the protocol to a common areaCarlos Martín Nieto2012-07-301-0/+3
| | | | | | | For the transition, http is going to keep its own logic until the git/common code catches up with the implied multi_ack that http has. This also has the side-effect of making the code cleaner and more correct regardingt he protocol.
* Remove old error handling codeMichael Schubert2012-07-171-10/+0
|
* Fix compile errors when building on windowsTim Clem2012-06-151-0/+1
| | | | Errors were due to not including winsock2 early enough.
* ssl: remove GnuTLS supportCarlos Martín Nieto2012-05-191-19/+0
| | | | | | It's too much work for now to redo everything. Move the ssl context struct to transport.h
* https: make it work with OpenSSL as wellCarlos Martín Nieto2012-05-191-0/+8
| | | | Add specific functions that use OpenSSL instead of GnuTLS
* http: add https support when GnuTLS is availableCarlos Martín Nieto2012-05-191-0/+10
| | | | | | | | If it's not available, an error saying so will be returned when trying to use a https:// URL. This also unifies a lot of the network code to use git_transport in many places instead of an socket descriptor.
* error-handling: On-disk config file backendVicent Martí2012-03-091-0/+12
| | | | | | | | | | | | | | | Includes: - Proper error reporting when encountering syntax errors in a config file (file, line number, column). - Rewritten `config_write`, now with 99% less goto-spaghetti - Error state in `git_filebuf`: filebuf write functions no longer need to be checked for error returns. If any of the writes performed on a buffer fail, the last call to `git_filebuf_commit` or `git_filebuf_hash` will fail accordingly and set the appropiate error message. Baller!
* Update Copyright headerschu2012-02-131-1/+1
| | | | Signed-off-by: schu <schu-github@schulog.org>
* msvc: Move `ssize_t` typedef to MSVC-onlyVicent Martí2012-01-261-4/+0
| | | | This is a MSVC-only issue. All other compilers we support work properly.
* repository: Change ownership semanticsVicent Marti2011-11-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ownership semantics have been changed all over the library to be consistent. There are no more "borrowed" or duplicated references. Main changes: - `git_repository_open2` and `3` have been dropped. - Added setters and getters to hotswap all the repository owned objects: `git_repository_index` `git_repository_set_index` `git_repository_odb` `git_repository_set_odb` `git_repository_config` `git_repository_set_config` `git_repository_workdir` `git_repository_set_workdir` Now working directories/index files/ODBs and so on can be hot-swapped after creating a repository and between operations. - All these objects now have proper ownership semantics with refcounting: they all require freeing after they are no longer needed (the repository always keeps its internal reference). - Repository open and initialization has been updated to keep in mind the configuration files. Bare repositories are now always detected, and a default config file is created on init. - All the tests affected by these changes have been dropped from the old test suite and ported to the new one.
* threads: Fix the shared global state with TLSVicent Marti2011-11-161-1/+0
| | | | | | | See `global.c` for a description of what we're doing. When libgit2 is built with GIT_THREADS support, the threading system must be explicitly initialized with `git_threads_init()`.
* msvc: Properly handle inttypes.h/stdint.hVicent Marti2011-10-051-3/+0
|
* Merge pull request #397 from lambourg/developmentVicent Martí2011-09-181-0/+2
|\ | | | | Fix compilation issues with mingw64 headers
| * Fix compilation issues with ming64 headersJerome Lambourg2011-09-121-0/+2
| |
* | Tabify everythingVicent Marti2011-09-191-2/+2
| | | | | | | | | | | | There were quite a few places were spaces were being used instead of tabs. Try to catch them all. This should hopefully not break anything. Except for `git blame`. Oh well.