vendor/libgit2/src/patch_parse.c in rugged-0.27.10.1 vs vendor/libgit2/src/patch_parse.c in rugged-0.28.0
- old
+ new
@@ -96,11 +96,11 @@
goto out;
patch->old_path = git_buf_detach(&old_path);
out:
- git_buf_free(&old_path);
+ git_buf_dispose(&old_path);
return error;
}
static int parse_header_git_newpath(
git_patch_parsed *patch, git_patch_parse_ctx *ctx)
@@ -112,11 +112,11 @@
goto out;
patch->new_path = git_buf_detach(&new_path);
out:
- git_buf_free(&new_path);
+ git_buf_dispose(&new_path);
return error;
}
static int parse_header_mode(uint16_t *mode, git_patch_parse_ctx *ctx)
{
@@ -280,11 +280,11 @@
return -1;
if (val < 0 || val > 100)
return -1;
- *out = val;
+ *out = (uint16_t)val;
return 0;
}
static int parse_header_similarity(
git_patch_parsed *patch, git_patch_parse_ctx *ctx)
@@ -516,11 +516,11 @@
hunk->hunk.header[hunk->hunk.header_len] = '\0';
return 0;
fail:
- giterr_set(GITERR_PATCH, "invalid patch hunk header at line %"PRIuZ,
+ git_error_set(GIT_ERROR_PATCH, "invalid patch hunk header at line %"PRIuZ,
ctx->parse_ctx.line_num);
return -1;
}
static int parse_hunk_body(
@@ -581,11 +581,11 @@
error = git_parse_err("invalid patch hunk at line %"PRIuZ, ctx->parse_ctx.line_num);
goto done;
}
line = git_array_alloc(patch->base.lines);
- GITERR_CHECK_ALLOC(line);
+ GIT_ERROR_CHECK_ALLOC(line);
memset(line, 0x0, sizeof(git_diff_line));
line->content = ctx->parse_ctx.line + prefix;
line->content_len = ctx->parse_ctx.line_len - prefix;
@@ -648,11 +648,11 @@
/* If this cannot be parsed as a hunk header, it's just leading
* noise, continue.
*/
if (parse_hunk_header(&hunk, ctx) < 0) {
- giterr_clear();
+ git_error_clear();
continue;
}
error = git_parse_err("invalid hunk header outside patch at line %"PRIuZ,
line_num);
@@ -671,11 +671,11 @@
error = 0;
continue;
}
- giterr_set(GITERR_PATCH, "no patch found");
+ git_error_set(GIT_ERROR_PATCH, "no patch found");
error = GIT_ENOTFOUND;
done:
return error;
}
@@ -755,12 +755,12 @@
binary->inflatedlen = (size_t)len;
binary->datalen = decoded.size;
binary->data = git_buf_detach(&decoded);
done:
- git_buf_free(&base85);
- git_buf_free(&decoded);
+ git_buf_dispose(&base85);
+ git_buf_dispose(&decoded);
return error;
}
static int parse_patch_binary(
git_patch_parsed *patch,
@@ -819,11 +819,11 @@
git_patch_hunk *hunk;
int error = 0;
while (git_parse_ctx_contains_s(&ctx->parse_ctx, "@@ -")) {
hunk = git_array_alloc(patch->base.hunks);
- GITERR_CHECK_ALLOC(hunk);
+ GIT_ERROR_CHECK_ALLOC(hunk);
memset(hunk, 0, sizeof(git_patch_hunk));
hunk->line_start = git_array_size(patch->base.lines);
hunk->line_count = 0;
@@ -1077,19 +1077,19 @@
assert(out && ctx);
*out = NULL;
patch = git__calloc(1, sizeof(git_patch_parsed));
- GITERR_CHECK_ALLOC(patch);
+ GIT_ERROR_CHECK_ALLOC(patch);
patch->ctx = ctx;
GIT_REFCOUNT_INC(patch->ctx);
patch->base.free_fn = patch_parsed__free;
patch->base.delta = git__calloc(1, sizeof(git_diff_delta));
- GITERR_CHECK_ALLOC(patch->base.delta);
+ GIT_ERROR_CHECK_ALLOC(patch->base.delta);
patch->base.delta->status = GIT_DELTA_MODIFIED;
patch->base.delta->nfiles = 2;
start = ctx->parse_ctx.remain_len;
@@ -1124,10 +1124,10 @@
{
git_patch_parse_ctx *ctx;
int error;
ctx = git_patch_parse_ctx_init(content, content_len, opts);
- GITERR_CHECK_ALLOC(ctx);
+ GIT_ERROR_CHECK_ALLOC(ctx);
error = git_patch_parse(out, ctx);
git_patch_parse_ctx_free(ctx);
return error;