libgit2/src
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
..
git Add the git_odb_exists() object query function 2009-02-11 11:04:55 -08:00
sha1 Add built-in (Mozilla) SHA1 routines 2009-03-17 18:54:42 -07:00
unix win32: Add routines to abstract memory-mapped file functions 2009-03-20 14:39:02 -07:00
win32 win32: Add <dirent.h> directory reading routines 2009-03-20 14:39:03 -07:00
cc-compat.h Add cc-compat.h - C compiler compat macros for internal use 2008-11-22 12:08:00 -08:00
commit.c Wrap malloc and friends and report out of memory as GIT_ENOMEM 2008-12-30 23:28:30 -08:00
commit.h Cleanup formatting in our head files to be more consistent 2008-12-30 21:52:07 -08:00
common.h win32: Add missing include for mkdir() and rmdir() 2009-03-30 07:18:42 -07:00
delta-apply.c Fix some (digital-mars) compiler warnings 2009-03-17 18:59:26 -07:00
delta-apply.h Add the binary delta apply algorithm for pack style deltas 2009-01-03 04:21:30 -08:00
dir.h win32: Add <dirent.h> directory reading routines 2009-03-20 14:39:03 -07:00
errors.c Set GIT_EOSERR when the OS errno should be consulted 2008-12-30 23:29:23 -08:00
errors.h Cleanup our header inclusion order to ensure pthread.h is early 2008-12-31 13:16:31 -08:00
fileops.c win32: Add routines to abstract memory-mapped file functions 2009-03-20 14:39:02 -07:00
fileops.h t0020-dirent.c: allow test to be run standalone 2009-03-30 07:18:42 -07:00
hash.c Add built-in (Mozilla) SHA1 routines 2009-03-17 18:54:42 -07:00
hash.h Add some routines for SHA1 hash computation 2008-12-30 07:48:10 -08:00
map.h win32: Add routines to abstract memory-mapped file functions 2009-03-20 14:39:02 -07:00
odb.c Fix a usage error in a call to the object_file_name() function 2009-06-05 10:21:11 +02:00
odb.h Add basic support to read pack-*.idx v1 and v2 files 2009-01-03 02:56:16 -08:00
oid.c Wrap malloc and friends and report out of memory as GIT_ENOMEM 2008-12-30 23:28:30 -08:00
revwalk.c Wrap malloc and friends and report out of memory as GIT_ENOMEM 2008-12-30 23:28:30 -08:00
revwalk.h Remove unnecessary import of stdlib.h from revwalk.h 2008-12-30 21:52:07 -08:00
thread-utils.c Wrap malloc and friends and report out of memory as GIT_ENOMEM 2008-12-30 23:28:30 -08:00
thread-utils.h Change the use of asm/atomic.h to require -DGIT_HAS_ASM_ATOMIC 2009-01-02 21:48:40 -08:00
util.c Fix some (digital-mars) compiler warnings 2009-03-17 18:59:26 -07:00
util.h Add git__dirname and git__basename utility routines 2009-01-28 12:25:24 -08:00