summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarson Howard <cjhoward92@users.noreply.github.com>2017-10-13 07:18:54 -0700
committerGitHub <noreply@github.com>2017-10-13 07:18:54 -0700
commit12a888d557bf2527ca4e7b20db3c5a623a8530f2 (patch)
tree42a3891a1de449f412342c5c428c7bc506fdd601
parent27ff888f5a17a88122da4e5d0aac33d5c6934804 (diff)
downloadlibgit2-12a888d557bf2527ca4e7b20db3c5a623a8530f2.tar.gz
examples: log: pass options pointer to print_commit
Cleaned up the PR to address styling issues.
-rw-r--r--examples/log.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/examples/log.c b/examples/log.c
index b339f1c13..a107470ee 100644
--- a/examples/log.c
+++ b/examples/log.c
@@ -49,7 +49,8 @@ static int add_revision(struct log_state *s, const char *revstr);
/** log_options holds other command line options that affect log output */
struct log_options {
- int show_diff, show_log_size;
+ int show_diff;
+ int show_log_size;
int skip, limit;
int min_parents, max_parents;
git_time_t before;
@@ -63,7 +64,7 @@ struct log_options {
static int parse_options(
struct log_state *s, struct log_options *opt, int argc, char **argv);
static void print_time(const git_time *intime, const char *prefix);
-static void print_commit(git_commit *commit, int show_log_size);
+static void print_commit(git_commit *commit, struct log_options *opts);
static int match_with_parent(git_commit *commit, int i, git_diff_options *);
/** utility functions for filtering */
@@ -148,7 +149,7 @@ int main(int argc, char *argv[])
break;
}
- print_commit(commit, opt.show_log_size);
+ print_commit(commit, &opt);
if (opt.show_diff) {
git_tree *a = NULL, *b = NULL;
@@ -337,7 +338,7 @@ static void print_time(const git_time *intime, const char *prefix)
}
/** Helper to print a commit object. */
-static void print_commit(git_commit *commit, int show_log_size)
+static void print_commit(git_commit *commit, struct log_options *opts)
{
char buf[GIT_OID_HEXSZ + 1];
int i, count;
@@ -347,9 +348,8 @@ static void print_commit(git_commit *commit, int show_log_size)
git_oid_tostr(buf, sizeof(buf), git_commit_id(commit));
printf("commit %s\n", buf);
- if (show_log_size) {
- printf("log size %d", (int)strlen(git_commit_message(commit)));
- printf("\n");
+ if (opts->show_log_size) {
+ printf("log size %d\n", (int)strlen(git_commit_message(commit)));
}
if ((count = (int)git_commit_parentcount(commit)) > 1) {