summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@elego.de>2011-03-31 15:29:13 +0200
committerCarlos Martín Nieto <cmn@elego.de>2011-03-31 15:29:13 +0200
commitf026f2b9ee5f0aeced5c366c890c4a29eee2a1c7 (patch)
treec26b59992df7ebe645cb9485a4eb70c41e127816 /src/util.c
parent11d0e70578baf47fb1cb565e0336e18d417e5da6 (diff)
parenta796d24cf697b0b51aa0ca7ef887e980f0d9fb7a (diff)
downloadlibgit2-f026f2b9ee5f0aeced5c366c890c4a29eee2a1c7.tar.gz
Merge upstream/development
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index c9a8e5fe9..995daf314 100644
--- a/src/util.c
+++ b/src/util.c
@@ -3,6 +3,15 @@
#include <stdarg.h>
#include <stdio.h>
+void git_strarray_free(git_strarray *array)
+{
+ size_t i;
+ for (i = 0; i < array->count; ++i)
+ free(array->strings[i]);
+
+ free(array->strings);
+}
+
int git__fmt(char *buf, size_t buf_sz, const char *fmt, ...)
{
va_list va;
@@ -214,6 +223,9 @@ void git__joinpath_n(char *buffer_out, int count, ...)
int len;
path = va_arg(ap, const char *);
+
+ assert((i == 0) || path != buffer_start);
+
if (i > 0 && *path == '/' && buffer_out > buffer_start && buffer_out[-1] == '/')
path++;