Commit c6e84bce by Edward Thomson

apply: use GIT_ASSERT

parent f60ebfcb
......@@ -5,8 +5,6 @@
* a Linking Exception. For full terms see the included COPYING file.
*/
#include "apply.h"
#include "git2/apply.h"
#include "git2/patch.h"
#include "git2/filter.h"
......@@ -21,6 +19,7 @@
#include "zstream.h"
#include "reader.h"
#include "index.h"
#include "apply.h"
typedef struct {
/* The lines that we allocate ourself are allocated out of the pool.
......@@ -399,7 +398,11 @@ int git_apply__patch(
unsigned int mode = 0;
int error = 0;
assert(contents_out && filename_out && mode_out && (source || !source_len) && patch);
GIT_ASSERT_ARG(contents_out);
GIT_ASSERT_ARG(filename_out);
GIT_ASSERT_ARG(mode_out);
GIT_ASSERT_ARG(source || !source_len);
GIT_ASSERT_ARG(patch);
if (given_opts)
memcpy(&ctx.opts, given_opts, sizeof(git_apply_options));
......@@ -624,7 +627,10 @@ int git_apply_to_tree(
size_t i;
int error = 0;
assert(out && repo && preimage && diff);
GIT_ASSERT_ARG(out);
GIT_ASSERT_ARG(repo);
GIT_ASSERT_ARG(preimage);
GIT_ASSERT_ARG(diff);
*out = NULL;
......@@ -772,6 +778,8 @@ done:
int git_apply_options_init(git_apply_options *opts, unsigned int version)
{
GIT_ASSERT_ARG(opts);
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
opts, version, git_apply_options, GIT_APPLY_OPTIONS_INIT);
return 0;
......@@ -805,7 +813,8 @@ int git_apply(
git_apply_options opts = GIT_APPLY_OPTIONS_INIT;
int error = GIT_EINVALID;
assert(repo && diff);
GIT_ASSERT_ARG(repo);
GIT_ASSERT_ARG(diff);
GIT_ERROR_CHECK_VERSION(
given_opts, GIT_APPLY_OPTIONS_VERSION, "git_apply_options");
......@@ -829,7 +838,7 @@ int git_apply(
error = git_reader_for_workdir(&pre_reader, repo, false);
break;
default:
assert(false);
GIT_ASSERT(false);
}
if (error < 0)
......@@ -869,7 +878,7 @@ int git_apply(
error = git_apply__to_workdir(repo, diff, preimage, postimage, location, &opts);
break;
default:
assert(false);
GIT_ASSERT(false);
}
if (error < 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment