diff options
| author | Nika Layzell <nika@thelayzells.com> | 2018-06-17 00:40:25 -0400 |
|---|---|---|
| committer | Nika Layzell <nika@thelayzells.com> | 2018-06-17 00:40:25 -0400 |
| commit | f98131be911df5e4c47e51ac92e6e7de79e30219 (patch) | |
| tree | 17f7717e6ff56fb82e236a7296a4bb4c1295043b /src/mailmap.c | |
| parent | 9faf36a6e89d1cc161bb6bf3afff7a3552b8a349 (diff) | |
| download | libgit2-f98131be911df5e4c47e51ac92e6e7de79e30219.tar.gz | |
Require the length argument to git_mailmap_from_buffer and make mailmap_add_buffer internal
Diffstat (limited to 'src/mailmap.c')
| -rw-r--r-- | src/mailmap.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/mailmap.c b/src/mailmap.c index b5fb7f69c..fe4d452d5 100644 --- a/src/mailmap.c +++ b/src/mailmap.c @@ -223,7 +223,7 @@ int git_mailmap_add_entry( replace_email, strlen(replace_email)); } -int git_mailmap_add_buffer(git_mailmap *mm, const char *buf, size_t len) +static int mailmap_add_buffer(git_mailmap *mm, const char *buf, size_t len) { int error; git_parse_ctx ctx; @@ -234,10 +234,6 @@ int git_mailmap_add_buffer(git_mailmap *mm, const char *buf, size_t len) git_buf replace_name = GIT_BUF_INIT; git_buf replace_email = GIT_BUF_INIT; - /* If `len` is passed as 0, use strlen to get the real length */ - if (buf && len == 0) - len = strlen(buf); - /* Buffers may not contain '\0's. */ if (memchr(buf, '\0', len) != NULL) return -1; @@ -278,7 +274,7 @@ int git_mailmap_from_buffer(git_mailmap **out, const char *data, size_t len) if (error < 0) return error; - error = git_mailmap_add_buffer(*out, data, len); + error = mailmap_add_buffer(*out, data, len); if (error < 0) { git_mailmap_free(*out); *out = NULL; @@ -308,7 +304,7 @@ static int mailmap_add_blob( if (error < 0) goto cleanup; - error = git_mailmap_add_buffer(mm, content.ptr, content.size); + error = mailmap_add_buffer(mm, content.ptr, content.size); if (error < 0) goto cleanup; @@ -335,7 +331,7 @@ static int mailmap_add_file_ondisk( if (error < 0) goto cleanup; - error = git_mailmap_add_buffer(mm, content.ptr, content.size); + error = mailmap_add_buffer(mm, content.ptr, content.size); if (error < 0) goto cleanup; |
