summaryrefslogtreecommitdiff
path: root/src/status.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2014-04-30 10:57:42 -0700
committerRussell Belfer <rb@github.com>2014-05-02 09:21:33 -0700
commit702efc891f2a620f10998062ba0c00b34100f632 (patch)
treee80132037df687837a40b5c3d8f1d6a079d35e43 /src/status.c
parent9c8ed4999740e921ecc2966bbcd0dbcfc725f59a (diff)
downloadlibgit2-702efc891f2a620f10998062ba0c00b34100f632.tar.gz
Make init_options fns use unsigned ints and macro
Use an unsigned int for the version and add a helper macro so the code is simplified (and so the error message is a common string).
Diffstat (limited to 'src/status.c')
-rw-r--r--src/status.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/status.c b/src/status.c
index aab838bcf..bcc2692d2 100644
--- a/src/status.c
+++ b/src/status.c
@@ -518,14 +518,10 @@ int git_status_should_ignore(
return git_ignore_path_is_ignored(ignored, repo, path);
}
-int git_status_init_options(git_status_options* opts, unsigned int version)
+int git_status_init_options(git_status_options *opts, unsigned int version)
{
- git_status_options o = GIT_STATUS_OPTIONS_INIT;
- if (version != o.version) {
- giterr_set(GITERR_INVALID, "Invalid version %d for git_status_options", version);
- return -1;
- }
- memcpy(opts, &o, sizeof(o));
+ GIT_INIT_STRUCTURE_FROM_TEMPLATE(
+ opts, version, git_status_options, GIT_STATUS_OPTIONS_INIT);
return 0;
}