summaryrefslogtreecommitdiff
path: root/src/buffer.h
diff options
context:
space:
mode:
authorVicent Martí <vicent@github.com>2013-01-30 14:45:12 -0800
committerVicent Martí <vicent@github.com>2013-01-30 14:45:12 -0800
commit5f9f69d983d7ebc2d9d29cf295e86f32ab12906d (patch)
treeddd32185ad0cb9b22da187ff234a14153c244d57 /src/buffer.h
parenta8182d495d3cf9f29b3339db7d6320a680a84690 (diff)
parent3bf68be443738c7de91eac9084277360346c8971 (diff)
downloadlibgit2-5f9f69d983d7ebc2d9d29cf295e86f32ab12906d.tar.gz
Merge pull request #1297 from arrbee/diff-patch-line-totals
Add helper API for diff line stats from patch
Diffstat (limited to 'src/buffer.h')
-rw-r--r--src/buffer.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/buffer.h b/src/buffer.h
index 4efd240b5..6e73895b4 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -134,6 +134,13 @@ GIT_INLINE(ssize_t) git_buf_rfind(git_buf *buf, char ch)
return idx;
}
+GIT_INLINE(ssize_t) git_buf_find(git_buf *buf, char ch)
+{
+ size_t idx = 0;
+ while (idx < buf->size && buf->ptr[idx] != ch) idx++;
+ return (idx == buf->size) ? -1 : (ssize_t)idx;
+}
+
/* Remove whitespace from the end of the buffer */
void git_buf_rtrim(git_buf *buf);