summaryrefslogtreecommitdiff
path: root/src/buffer.h
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-05-17 13:14:17 -0700
committerRussell Belfer <rb@github.com>2012-05-17 13:14:17 -0700
commita0d959628f2a9eff65088c3247f237aef5205e73 (patch)
treeaac7165f30baf60f9181b780fabca06d2748935a /src/buffer.h
parentb59c73d39a0bb3ddb6fd4e81f796018c2b3a0579 (diff)
downloadlibgit2-a0d959628f2a9eff65088c3247f237aef5205e73.tar.gz
Other optimization and warning fixes
This fixes a warning left by the earlier optimization and addresses one of the other hotspots identified by GProf.
Diffstat (limited to 'src/buffer.h')
-rw-r--r--src/buffer.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/buffer.h b/src/buffer.h
index 090b43548..50c75f64e 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -15,9 +15,10 @@ typedef struct {
size_t asize, size;
} git_buf;
-extern char git_buf_initbuf[];
+extern char git_buf__initbuf[];
+extern char git_buf__oom[];
-#define GIT_BUF_INIT { git_buf_initbuf, 0, 0 }
+#define GIT_BUF_INIT { git_buf__initbuf, 0, 0 }
/**
* Initialize a git_buf structure.
@@ -61,7 +62,10 @@ void git_buf_attach(git_buf *buf, char *ptr, size_t asize);
*
* @return false if no error, true if allocation error
*/
-bool git_buf_oom(const git_buf *buf);
+GIT_INLINE(bool) git_buf_oom(const git_buf *buf)
+{
+ return (buf->ptr == git_buf__oom);
+}
/*
* Functions below that return int value error codes will return 0 on