Name |
Last commit
|
Last update |
---|---|---|
src | ||
tests | ||
.HEADER | ||
.gitignore | ||
CONVENTIONS | ||
COPYING | ||
Makefile | ||
api.doxygen | ||
git.git-authors | ||
libgit2.pc.in |
In 82324ac1, 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>
Name |
Last commit
|
Last update |
---|---|---|
src | Loading commit data... | |
tests | Loading commit data... | |
.HEADER | Loading commit data... | |
.gitignore | Loading commit data... | |
CONVENTIONS | Loading commit data... | |
COPYING | Loading commit data... | |
Makefile | Loading commit data... | |
api.doxygen | Loading commit data... | |
git.git-authors | Loading commit data... | |
libgit2.pc.in | Loading commit data... |