- 28 Feb, 2010 8 commits
-
-
Given an index entry number, the idx_get() function returns an (version agnostic) index_entry structure containing all of the information required to unpack the corresponding object from the '.pack' file. Since the v1 and v2 file formats differ in the layout of the object records, we provide two implementations of the get function and initialise the function pointer appropriately. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones committed -
In addition to searching the index by oid, we need to search by '.pack' file offset, particularly when processing OBJ_OFS_DELTA objects. Since the v1 and v2 file formats differ in the layout of the object records, we provide two implementations of the search function and initialise the (virtual) function pointer appropriately. Note that, as part of the creation of the 'offset index', we also add a check that the offset data in the index is within the bounds of the '.pack' file. Having sorted the file offsets, while creating the index, we only need to check the smallest and largest values. The offset index consists of the im_off_idx array, which contains the index entry numbers sorted into file offset order, and the im_off_next mapping array. The im_off_next array maps an index entry number to the 'next' index entry in file offset order. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones committed -
In particular, on a successful search, we now return the index entry number of the object rather than the '.pack' file offset. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones committed -
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones committed -
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones committed -
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones committed -
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones committed -
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones committed
-
- 01 Feb, 2010 1 commit
-
-
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones committed
-
- 20 Jan, 2010 12 commits
-
-
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones committed -
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones committed -
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones committed -
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones committed -
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones committed -
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones committed -
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones committed -
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones committed -
This reduces the global namespace pollution and allows for a win32 compiler (eg. Open Watcom) to provide these routines in a header other than <dirent.h> (eg in <io.h>). Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones committed -
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones committed -
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones committed -
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones committed
-
- 13 Oct, 2009 6 commits
-
-
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones committed -
Add a new "coverage" Makefile target that re-builds the library and tests using the gcc compiler/linker flags required by gcov, runs the test suite to capture the runtime data, then compiles a coverage report. The report, which is saved in a file named "untested", consists of a list of untested files, followed by a list of untested functions. More detailed execution statistics are given in the gcov log files which are saved in the top-level directory (named like src#hash.c.gcov). Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones committed -
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones committed -
Add some makefile targets, which use valgrind's memcheck tool to run the tests, in order to help diagnose memory problems in the library. In addition, we enable the '--leak-check' option to report on any memory leaks. However, unlike the other memory problems reported by memcheck, memory leak reports do not result in an error exit from valgrind. (So memory leaks are reported on stderr, but don't halt the test run.) A suppressions file (tests.supp) is included since libz triggers some false positives. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones committed -
Some win32 compilers define the SSIZE_T type, with the same meaning and intent as ssize_t. If available, make ssize_t a synonym of SSIZE_T. At present, the Digital-Mars compiler is known not to define SSIZE_T, so we provide an SSIZE_T macro to use in the typedef. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones committed -
In addition to removing the inline #define, commit 209849a4 also removed a #pragma to disable msvc deprecated function warnings. Without this #pragma, msvc currently issues 19 warnings related to "deprecated insecure c-library functions", such as strcpy() and 22 warnings related to "deprecated POSIX function names", such as open(). In order to supress these warnings, re-instate the #pragma. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones committed
-
- 16 Jun, 2009 2 commits
-
-
No need to define inline as __inline because libgit2 code should be using GIT_INLINE instead. Signed-off-by: Julio Espinoza-Sokal <julioes@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
Julio Espinoza-Sokal committed -
MSVC provides a compiler declaration to declare that a function never returns. This declaration is required in front of the function definition rather than at the end, but fortunately gcc is compatible with this location as well. Explicit returns are no longer required after calls to test_die. Signed-off-by: Julio Espinoza-Sokal <julioes@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
Julio Espinoza-Sokal committed
-
- 15 Jun, 2009 3 commits
-
-
For information on FlushFileBuffers(), see the msdn document at msdn.microsoft.com/en-us/library/aa364439(VS.85).aspx Note that Windows 2000 is shown as the minimum windows version to support FlushFileBuffers(), so if we wish to support Win9X and NT4, we will need to add code to dynamically check if kernel32.dll contains the function. The only error return mentioned in the msdn document is ERROR_INVALID_HANDLE, which is returned if the file/device (eg console) is not buffered. The fsync(2) manpage says that EINVAL is returned in errno, if "fd is bound to a special file which does not support synchronization". Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones committed -
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones committed -
When setting the default value, the macro name was specified as GIT_FLEX_ARRAY, which is inconsistent with it's earlier usage in the file. This caused a compilation error, using the MS Visual C/C++ compiler, when compiling the git_packlist struct definition in src/odb.c. In addition to changing the spelling of the FLEX_ARRAY macro to GIT_FLEX_ARRAY, including it's use in src/odb.c, we also rename the TYPEOF macro to GIT_TYPEOF. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones committed
-
- 05 Jun, 2009 8 commits
-
-
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones committed -
This supresses some "conversion from 'size_t' to 'unsigned int', possible loss of data" warning messages from the MS Visual C/C++ compiler with -Wp64. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones committed -
In particular, in standard C, a struct or union must have at least one member declared (ie. structs and unions cannot be empty). Some compilers allow empty structs as an extension and won't even issue a warning unless asked for it (eg, gcc requires -pedantic). Some compilers allow empty structs as an extension and will only treat it as an error if asked for strict checking (eg Digital-Mars with -A). Some compilers simply treat it as an error (eg MS Visual C/C++). Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones committed -
In particular, the one_entry() and dont_call_me() callback functions require explicit returns, in order to suppress some "control path" compiler warnings (from MS Visual C/C++). Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones committed -
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones committed -
Also, add the <string.h> include to test_main.c, in order to suppress the resulting "implicit declaration of strcmp()" warning. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones committed -
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones committed -
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones committed
-