Go to file
Ramsay Jones ac04bdf6e0 Fix a usage error in a call to the object_file_name() function
In 82324ac, the new static function exists_loose() called
object_file_name() and, in order to detect an error return,
tested for a negative value. This usage is incorrect, as
the error return is indicated by a positive return value.
(A successful call is indicated by a zero return value)

The only error return from object_file_name() relates to
insufficient buffer space and the return value gives the
required minimum buffer size (which will always be >0).

If the caller requires a dynamically allocated buffer,
this allows something like the following call sequence:

    size_t len = object_file_name(NULL, 0, db->object_dir, id);
    char *buf = git__malloc(len);
    if (!buf)
        error(...);
    object_file_name(buf, len, db->object_dir,id);
    ...

No current callers take advantage of this capability.

Fix up the call site and change the return type of the
function, from int to size_t, which more accurately
reflects the implementation.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Andreas Ericsson <ae@op5.se>
2009-06-05 10:21:11 +02:00
src Fix a usage error in a call to the object_file_name() function 2009-06-05 10:21:11 +02:00
tests Fix comments in renamed t020?-readloose tests 2009-03-30 07:18:42 -07:00
.gitignore Add pkg-config support. 2008-12-30 07:31:03 -08:00
.HEADER Switch the license from BSD to GPL+libgcc exception 2008-11-01 15:55:47 -07:00
api.doxygen doxygen config: Update path to public headers 2008-12-02 08:45:03 -08:00
CONVENTIONS Move include files to include/git/, drop git_ prefix from file names 2008-11-01 15:42:23 -07:00
COPYING Switch the license from BSD to GPL+libgcc exception 2008-11-01 15:55:47 -07:00
git.git-authors Add Adam Simpkins to list of consenting authors 2008-12-09 08:36:10 -08:00
libgit2.pc.in Add support for installing to a libdir other than 'lib'. 2009-02-01 15:00:10 -08:00
Makefile win32: Add routines to abstract memory-mapped file functions 2009-03-20 14:39:02 -07:00