diff options
| author | Shawn O. Pearce <spearce@spearce.org> | 2008-12-30 23:21:36 -0800 |
|---|---|---|
| committer | Shawn O. Pearce <spearce@spearce.org> | 2008-12-30 23:28:30 -0800 |
| commit | 64a47c01426a36cdb7e598d17018d5791e54bb97 (patch) | |
| tree | c96d985df9957e7c042290d868d44feed8a4fc08 /src/git | |
| parent | ffb55c532ccc1cb3c47eeeaac6c64240ab88fe29 (diff) | |
| download | libgit2-64a47c01426a36cdb7e598d17018d5791e54bb97.tar.gz | |
Wrap malloc and friends and report out of memory as GIT_ENOMEM
We now forbid direct use of malloc, strdup or calloc within the
library and instead use wrapper functions git__malloc, etc. to
invoke the underlying library malloc and set git_errno to a no
memory error code if the allocation fails.
In the future once we have pack objects in memory we are likely
to enhance these routines with garbage collection logic to purge
cached pack data when allocations fail. Because the size of the
function will grow somewhat large, we don't want to mark them for
inline as gcc tends to aggressively inline, creating larger than
expected executables.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'src/git')
| -rw-r--r-- | src/git/common.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/git/common.h b/src/git/common.h index 87f7f3729..639753339 100644 --- a/src/git/common.h +++ b/src/git/common.h @@ -55,6 +55,9 @@ /** Input does not exist in the scope searched. */ #define GIT_ENOTFOUND (GIT_ERROR - 2) +/** Not enough space available. */ +#define GIT_ENOMEM (GIT_ERROR - 3) + GIT_BEGIN_DECL /** A revision traversal pool. */ |
