{"thread":{"id":"15667","subject":"[PATCH] graph.c: make many functions static","startedAt":"2008-09-25T09:41:08Z","lastAt":"2008-09-25T09:41:08Z","messageCount":1,"participants":["Nanako Shiraishi"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"91569","messageId":"20080925184108.6117@nanako3.lavabit.com","threadId":"15667","inReplyTo":null,"subject":"[PATCH] graph.c: make many functions static","fromName":"Nanako Shiraishi","fromEmail":"nanako3@lavabit.com","sentAt":"2008-09-25T09:41:08Z","receivedAt":"2008-09-25T09:41:08Z","isPatch":true,"sender":{"key":"nanako3@lavabit.com","avatar":"https://gravatar.com/avatar/3777b9e201c5883a62b1a6fdf7c53f2d712d1d80989146063ea861e33aad72a8?d=mp&s=160"},"body":"These function are not used anywhere.  Also removes graph_release()\nthat is never called.\n\nSigned-off-by: Nanako Shiraishi <nanako3@lavabit.com>\n---\n graph.c |   57 +++++++++++++++++++++++++++++++++++++++++++--------------\n graph.h |   40 ----------------------------------------\n 2 files changed, 43 insertions(+), 54 deletions(-)\n\ndiff --git a/graph.c b/graph.c\nindex e2633f8..5f82170 100644\n--- a/graph.c\n+++ b/graph.c\n@@ -4,6 +4,43 @@\n #include \"diff.h\"\n #include \"revision.h\"\n \n+/* Internal API */\n+\n+/*\n+ * Output the next line for a graph.\n+ * This formats the next graph line into the specified strbuf.  It is not\n+ * terminated with a newline.\n+ *\n+ * Returns 1 if the line includes the current commit, and 0 otherwise.\n+ * graph_next_line() will return 1 exactly once for each time\n+ * graph_update() is called.\n+ */\n+static int graph_next_line(struct git_graph *graph, struct strbuf *sb);\n+\n+/*\n+ * Output a padding line in the graph.\n+ * This is similar to graph_next_line().  However, it is guaranteed to\n+ * never print the current commit line.  Instead, if the commit line is\n+ * next, it will simply output a line of vertical padding, extending the\n+ * branch lines downwards, but leaving them otherwise unchanged.\n+ */\n+static void graph_padding_line(struct git_graph *graph, struct strbuf *sb);\n+\n+/*\n+ * Print a strbuf to stdout.  If the graph is non-NULL, all lines but the\n+ * first will be prefixed with the graph output.\n+ *\n+ * If the strbuf ends with a newline, the output will end after this\n+ * newline.  A new graph line will not be printed after the final newline.\n+ * If the strbuf is empty, no output will be printed.\n+ *\n+ * Since the first line will not include the graph ouput, the caller is\n+ * responsible for printing this line's graph (perhaps via\n+ * graph_show_commit() or graph_show_oneline()) before calling\n+ * graph_show_strbuf().\n+ */\n+static void graph_show_strbuf(struct git_graph *graph, struct strbuf const *sb);\n+\n /*\n  * TODO:\n  * - Add colors to the graph.\n@@ -180,14 +217,6 @@ struct git_graph *graph_init(struct rev_info *opt)\n \treturn graph;\n }\n \n-void graph_release(struct git_graph *graph)\n-{\n-\tfree(graph->columns);\n-\tfree(graph->new_columns);\n-\tfree(graph->mapping);\n-\tfree(graph);\n-}\n-\n static void graph_update_state(struct git_graph *graph, enum graph_state s)\n {\n \tgraph->prev_state = graph->state;\n@@ -685,7 +714,7 @@ static void graph_output_commit_char(struct git_graph *graph, struct strbuf *sb)\n \tstrbuf_addch(sb, '*');\n }\n \n-void graph_output_commit_line(struct git_graph *graph, struct strbuf *sb)\n+static void graph_output_commit_line(struct git_graph *graph, struct strbuf *sb)\n {\n \tint seen_this = 0;\n \tint i, j;\n@@ -760,7 +789,7 @@ void graph_output_commit_line(struct git_graph *graph, struct strbuf *sb)\n \t\tgraph_update_state(graph, GRAPH_COLLAPSING);\n }\n \n-void graph_output_post_merge_line(struct git_graph *graph, struct strbuf *sb)\n+static void graph_output_post_merge_line(struct git_graph *graph, struct strbuf *sb)\n {\n \tint seen_this = 0;\n \tint i, j;\n@@ -801,7 +830,7 @@ void graph_output_post_merge_line(struct git_graph *graph, struct strbuf *sb)\n \t\tgraph_update_state(graph, GRAPH_COLLAPSING);\n }\n \n-void graph_output_collapsing_line(struct git_graph *graph, struct strbuf *sb)\n+static void graph_output_collapsing_line(struct git_graph *graph, struct strbuf *sb)\n {\n \tint i;\n \tint *tmp_mapping;\n@@ -906,7 +935,7 @@ void graph_output_collapsing_line(struct git_graph *graph, struct strbuf *sb)\n \t\tgraph_update_state(graph, GRAPH_PADDING);\n }\n \n-int graph_next_line(struct git_graph *graph, struct strbuf *sb)\n+static int graph_next_line(struct git_graph *graph, struct strbuf *sb)\n {\n \tswitch (graph->state) {\n \tcase GRAPH_PADDING:\n@@ -933,7 +962,7 @@ int graph_next_line(struct git_graph *graph, struct strbuf *sb)\n \treturn 0;\n }\n \n-void graph_padding_line(struct git_graph *graph, struct strbuf *sb)\n+static void graph_padding_line(struct git_graph *graph, struct strbuf *sb)\n {\n \tint i, j;\n \n@@ -1055,7 +1084,7 @@ int graph_show_remainder(struct git_graph *graph)\n }\n \n \n-void graph_show_strbuf(struct git_graph *graph, struct strbuf const *sb)\n+static void graph_show_strbuf(struct git_graph *graph, struct strbuf const *sb)\n {\n \tchar *p;\n \ndiff --git a/graph.h b/graph.h\nindex eab4e3d..bc30d68 100644\n--- a/graph.h\n+++ b/graph.h\n@@ -11,11 +11,6 @@ struct git_graph;\n struct git_graph *graph_init(struct rev_info *opt);\n \n /*\n- * Destroy a struct git_graph and free associated memory.\n- */\n-void graph_release(struct git_graph *graph);\n-\n-/*\n  * Update a git_graph with a new commit.\n  * This will cause the graph to begin outputting lines for the new commit\n  * the next time graph_next_line() is called.\n@@ -27,26 +22,6 @@ void graph_release(struct git_graph *graph);\n void graph_update(struct git_graph *graph, struct commit *commit);\n \n /*\n- * Output the next line for a graph.\n- * This formats the next graph line into the specified strbuf.  It is not\n- * terminated with a newline.\n- *\n- * Returns 1 if the line includes the current commit, and 0 otherwise.\n- * graph_next_line() will return 1 exactly once for each time\n- * graph_update() is called.\n- */\n-int graph_next_line(struct git_graph *graph, struct strbuf *sb);\n-\n-/*\n- * Output a padding line in the graph.\n- * This is similar to graph_next_line().  However, it is guaranteed to\n- * never print the current commit line.  Instead, if the commit line is\n- * next, it will simply output a line of vertical padding, extending the\n- * branch lines downwards, but leaving them otherwise unchanged.\n- */\n-void graph_padding_line(struct git_graph *graph, struct strbuf *sb);\n-\n-/*\n  * Determine if a graph has finished outputting lines for the current\n  * commit.\n  *\n@@ -90,21 +65,6 @@ void graph_show_padding(struct git_graph *graph);\n int graph_show_remainder(struct git_graph *graph);\n \n /*\n- * Print a strbuf to stdout.  If the graph is non-NULL, all lines but the\n- * first will be prefixed with the graph output.\n- *\n- * If the strbuf ends with a newline, the output will end after this\n- * newline.  A new graph line will not be printed after the final newline.\n- * If the strbuf is empty, no output will be printed.\n- *\n- * Since the first line will not include the graph ouput, the caller is\n- * responsible for printing this line's graph (perhaps via\n- * graph_show_commit() or graph_show_oneline()) before calling\n- * graph_show_strbuf().\n- */\n-void graph_show_strbuf(struct git_graph *graph, struct strbuf const *sb);\n-\n-/*\n  * Print a commit message strbuf and the remainder of the graph to stdout.\n  *\n  * This is similar to graph_show_strbuf(), but it always prints the\n-- \n1.6.0.2\n\n-- \nNanako Shiraishi\nhttp://ivory.ap.teacup.com/nanako3/\n"}]}