Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d9de12f

Browse files
committed
fix log example
1 parent ac0f224 commit d9de12f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/log.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,11 @@ int lg2_log(git_repository *repo, int argc, char *argv[])
8181
git_commit *commit = NULL;
8282
git_pathspec *ps = NULL;
8383

84+
memset(&s, 0, sizeof(s));
85+
8486
/** Parse arguments and set up revwalker. */
85-
last_arg = parse_options(&s, &opt, argc, argv);
8687
s.repo = repo;
88+
last_arg = parse_options(&s, &opt, argc, argv);
8789

8890
diffopts.pathspec.strings = &argv[last_arg];
8991
diffopts.pathspec.count = argc - last_arg;
@@ -407,8 +409,6 @@ static int parse_options(
407409
struct log_state *s, struct log_options *opt, int argc, char **argv)
408410
{
409411
struct args_info args = ARGS_INFO_INIT;
410-
411-
memset(s, 0, sizeof(*s));
412412
s->sorting = GIT_SORT_TIME;
413413

414414
memset(opt, 0, sizeof(*opt));

0 commit comments

Comments
 (0)