@matheusbsbs / matheus-bagliano / commits / 064bfbde45
Fork 0

graph.c: make many functions static

These function are not used anywhere. Also removes graph_release() that is never called. Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Nanako Shiraishi committed Sep 25, 2008 at 18:41 UTC 064bfbde45e5ad70a5f8a2290ff3fbed0b69f326
2 files changed +43 -54
graph.c
+43 -14
@@ -4,6 +4,43 @@
4 #include "diff.h"
5 #include "revision.h"
6
7 +/* Internal API */
8 +
9 +/*
10 + * Output the next line for a graph.
11 + * This formats the next graph line into the specified strbuf. It is not
12 + * terminated with a newline.
13 + *
14 + * Returns 1 if the line includes the current commit, and 0 otherwise.
15 + * graph_next_line() will return 1 exactly once for each time
16 + * graph_update() is called.
17 + */
18 +static int graph_next_line(struct git_graph *graph, struct strbuf *sb);
19 +
20 +/*
21 + * Output a padding line in the graph.
22 + * This is similar to graph_next_line(). However, it is guaranteed to
23 + * never print the current commit line. Instead, if the commit line is
24 + * next, it will simply output a line of vertical padding, extending the
25 + * branch lines downwards, but leaving them otherwise unchanged.
26 + */
27 +static void graph_padding_line(struct git_graph *graph, struct strbuf *sb);
28 +
29 +/*
30 + * Print a strbuf to stdout. If the graph is non-NULL, all lines but the
31 + * first will be prefixed with the graph output.
32 + *
33 + * If the strbuf ends with a newline, the output will end after this
34 + * newline. A new graph line will not be printed after the final newline.
35 + * If the strbuf is empty, no output will be printed.
36 + *
37 + * Since the first line will not include the graph ouput, the caller is
38 + * responsible for printing this line's graph (perhaps via
39 + * graph_show_commit() or graph_show_oneline()) before calling
40 + * graph_show_strbuf().
41 + */
42 +static void graph_show_strbuf(struct git_graph *graph, struct strbuf const *sb);
43 +
44 /*
45 * TODO:
46 * - Add colors to the graph.
@@ -180,14 +217,6 @@ struct git_graph *graph_init(struct rev_info *opt)
217 return graph;
218 }
219
183 -void graph_release(struct git_graph *graph)
184 -{
185 - free(graph->columns);
186 - free(graph->new_columns);
187 - free(graph->mapping);
188 - free(graph);
189 -}
190 -
220 static void graph_update_state(struct git_graph *graph, enum graph_state s)
221 {
222 graph->prev_state = graph->state;
@@ -685,7 +714,7 @@ static void graph_output_commit_char(struct git_graph *graph, struct strbuf *sb)
714 strbuf_addch(sb, '*');
715 }
716
688 -void graph_output_commit_line(struct git_graph *graph, struct strbuf *sb)
717 +static void graph_output_commit_line(struct git_graph *graph, struct strbuf *sb)
718 {
719 int seen_this = 0;
720 int i, j;
@@ -760,7 +789,7 @@ void graph_output_commit_line(struct git_graph *graph, struct strbuf *sb)
789 graph_update_state(graph, GRAPH_COLLAPSING);
790 }
791
763 -void graph_output_post_merge_line(struct git_graph *graph, struct strbuf *sb)
792 +static void graph_output_post_merge_line(struct git_graph *graph, struct strbuf *sb)
793 {
794 int seen_this = 0;
795 int i, j;
@@ -801,7 +830,7 @@ void graph_output_post_merge_line(struct git_graph *graph, struct strbuf *sb)
830 graph_update_state(graph, GRAPH_COLLAPSING);
831 }
832
804 -void graph_output_collapsing_line(struct git_graph *graph, struct strbuf *sb)
833 +static void graph_output_collapsing_line(struct git_graph *graph, struct strbuf *sb)
834 {
835 int i;
836 int *tmp_mapping;
@@ -906,7 +935,7 @@ void graph_output_collapsing_line(struct git_graph *graph, struct strbuf *sb)
935 graph_update_state(graph, GRAPH_PADDING);
936 }
937
909 -int graph_next_line(struct git_graph *graph, struct strbuf *sb)
938 +static int graph_next_line(struct git_graph *graph, struct strbuf *sb)
939 {
940 switch (graph->state) {
941 case GRAPH_PADDING:
@@ -933,7 +962,7 @@ int graph_next_line(struct git_graph *graph, struct strbuf *sb)
962 return 0;
963 }
964
936 -void graph_padding_line(struct git_graph *graph, struct strbuf *sb)
965 +static void graph_padding_line(struct git_graph *graph, struct strbuf *sb)
966 {
967 int i, j;
968
@@ -1055,7 +1084,7 @@ int graph_show_remainder(struct git_graph *graph)
1084 }
1085
1086
1058 -void graph_show_strbuf(struct git_graph *graph, struct strbuf const *sb)
1087 +static void graph_show_strbuf(struct git_graph *graph, struct strbuf const *sb)
1088 {
1089 char *p;
1090
graph.h
-40
@@ -10,11 +10,6 @@ struct git_graph;
10 */
11 struct git_graph *graph_init(struct rev_info *opt);
12
13 -/*
14 - * Destroy a struct git_graph and free associated memory.
15 - */
16 -void graph_release(struct git_graph *graph);
17 -
13 /*
14 * Update a git_graph with a new commit.
15 * This will cause the graph to begin outputting lines for the new commit
@@ -26,26 +21,6 @@ void graph_release(struct git_graph *graph);
21 */
22 void graph_update(struct git_graph *graph, struct commit *commit);
23
29 -/*
30 - * Output the next line for a graph.
31 - * This formats the next graph line into the specified strbuf. It is not
32 - * terminated with a newline.
33 - *
34 - * Returns 1 if the line includes the current commit, and 0 otherwise.
35 - * graph_next_line() will return 1 exactly once for each time
36 - * graph_update() is called.
37 - */
38 -int graph_next_line(struct git_graph *graph, struct strbuf *sb);
39 -
40 -/*
41 - * Output a padding line in the graph.
42 - * This is similar to graph_next_line(). However, it is guaranteed to
43 - * never print the current commit line. Instead, if the commit line is
44 - * next, it will simply output a line of vertical padding, extending the
45 - * branch lines downwards, but leaving them otherwise unchanged.
46 - */
47 -void graph_padding_line(struct git_graph *graph, struct strbuf *sb);
48 -
24 /*
25 * Determine if a graph has finished outputting lines for the current
26 * commit.
@@ -89,21 +64,6 @@ void graph_show_padding(struct git_graph *graph);
64 */
65 int graph_show_remainder(struct git_graph *graph);
66
92 -/*
93 - * Print a strbuf to stdout. If the graph is non-NULL, all lines but the
94 - * first will be prefixed with the graph output.
95 - *
96 - * If the strbuf ends with a newline, the output will end after this
97 - * newline. A new graph line will not be printed after the final newline.
98 - * If the strbuf is empty, no output will be printed.
99 - *
100 - * Since the first line will not include the graph ouput, the caller is
101 - * responsible for printing this line's graph (perhaps via
102 - * graph_show_commit() or graph_show_oneline()) before calling
103 - * graph_show_strbuf().
104 - */
105 -void graph_show_strbuf(struct git_graph *graph, struct strbuf const *sb);
106 -
67 /*
68 * Print a commit message strbuf and the remainder of the graph to stdout.
69 *