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:
authorEdward Thomson <ethomson@edwardthomson.com>2012-12-12 08:31:21 +0400
committerEdward Thomson <ethomson@edwardthomson.com>2012-12-20 02:57:30 +0400
commit7fcec8342890031a0d22f0d013833badd81091e8 (patch)
tree9b09ab2eb1d111d5662a1f0f0b7fa13df07587d0 /src/util.c
parent5c3c86b06e84ac70735b2629209de2dcc0e09034 (diff)
fetchhead reading/iterating
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index 6df32b1c3..059e55dd7 100644
--- a/src/util.c
+++ b/src/util.c
@@ -276,6 +276,24 @@ char *git__strtok(char **end, const char *sep)
return NULL;
}
+/* Similar to strtok, but does not collapse repeated tokens. */
+char *git__strsep(char **end, const char *sep)
+{
+ char *start = *end, *ptr = *end;
+
+ while (*ptr && !strchr(sep, *ptr))
+ ++ptr;
+
+ if (*ptr) {
+ *end = ptr + 1;
+ *ptr = '\0';
+
+ return start;
+ }
+
+ return NULL;
+}
+
void git__hexdump(const char *buffer, size_t len)
{
static const size_t LINE_WIDTH = 16;