Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-05-16 03:33:05 +0400
committerRussell Belfer <rb@github.com>2012-05-16 03:33:05 +0400
commit2c8339172878cd935eee0d9eb6db747cebd70a72 (patch)
treec5499b848395ad1a2efddeb092d6c00e8421f226 /src/buffer.c
parent58ffeb9cde4091a714322157836954eb45129fad (diff)
Document git_buf_common_prefix
This function fills in a git_buf with the common prefix of an array of strings, but let's make that a little more clear.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 8687d5537..ef95839f6 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -426,10 +426,13 @@ int git_buf_common_prefix(git_buf *buf, const git_strarray *strings)
if (!strings || !strings->count)
return 0;
+ /* initialize common prefix to first string */
if (git_buf_sets(buf, strings->strings[0]) < 0)
return -1;
+ /* go through the rest of the strings, truncating to shared prefix */
for (i = 1; i < strings->count; ++i) {
+
for (str = strings->strings[i], pfx = buf->ptr;
*str && *str == *pfx; str++, pfx++)
/* scanning */;