login
Header Space

 
 

[PATCH 1/6] Rename git_one_line() to git_line_length() and export it

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Alberto Bertogli <albertito@...>, <git@...>, <gitster@...>, Johan Herland <johan@...>
Date: Sunday, July 15, 2007 - 7:22 pm

The function get_one_line() really returns the line length, not the
whole line, but it is really useful, so do not hide it in commit.c,
under the wrong name.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 commit.c |   10 +++++-----
 commit.h |    1 +
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/commit.c b/commit.c
index 4c5dfa9..0c350bc 100644
--- a/commit.c
+++ b/commit.c
@@ -458,7 +458,7 @@ void clear_commit_marks(struct commit *commit, unsigned int mark)
 /*
  * Generic support for pretty-printing the header
  */
-static int get_one_line(const char *msg, unsigned long len)
+int get_line_length(const char *msg, unsigned long len)
 {
 	int ret = 0;
 
@@ -950,7 +950,7 @@ static void pp_header(enum cmit_fmt fmt,
 	for (;;) {
 		const char *line = *msg_p;
 		char *dst;
-		int linelen = get_one_line(*msg_p, *len_p);
+		int linelen = get_line_length(*msg_p, *len_p);
 		unsigned long len;
 
 		if (!linelen)
@@ -1041,7 +1041,7 @@ static void pp_title_line(enum cmit_fmt fmt,
 	title = xmalloc(title_alloc);
 	for (;;) {
 		const char *line = *msg_p;
-		int linelen = get_one_line(line, *len_p);
+		int linelen = get_line_length(line, *len_p);
 		*msg_p += linelen;
 		*len_p -= linelen;
 
@@ -1118,7 +1118,7 @@ static void pp_remainder(enum cmit_fmt fmt,
 	int first = 1;
 	for (;;) {
 		const char *line = *msg_p;
-		int linelen = get_one_line(line, *len_p);
+		int linelen = get_line_length(line, *len_p);
 		*msg_p += linelen;
 		*len_p -= linelen;
 
@@ -1214,7 +1214,7 @@ unsigned long pretty_print_commit(enum cmit_fmt fmt,
 
 	/* Skip excess blank lines at the beginning of body, if any... */
 	for (;;) {
-		int linelen = get_one_line(msg, len);
+		int linelen = get_line_length(msg, len);
 		int ll = linelen;
 		if (!linelen)
 			break;
diff --git a/commit.h b/commit.h
index 467872e..fc6df23 100644
--- a/commit.h
+++ b/commit.h
@@ -60,6 +60,7 @@ enum cmit_fmt {
 	CMIT_FMT_UNSPECIFIED,
 };
 
+extern int get_line_length(const char *msg, unsigned long len);
 extern enum cmit_fmt get_commit_format(const char *arg);
 extern unsigned long pretty_print_commit(enum cmit_fmt fmt, const struct commit *, unsigned long len, char **buf_p, unsigned long *space_p, int abbrev, const char *subject, const char *after_subject, enum date_mode dmode);
 
-- 
1.5.3.rc1.2718.gd2dc9-dirty


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/6] Introduce commit notes, Johannes Schindelin, (Sun Jul 15, 7:19 pm)
Re: [PATCH 0/6] Introduce commit notes, Andy Parkins, (Mon Jul 16, 3:57 am)
Re: [PATCH 0/6] Introduce commit notes, Junio C Hamano, (Mon Jul 16, 4:11 am)
Re: [PATCH 0/6] Introduce commit notes, Johannes Schindelin, (Mon Jul 16, 12:26 pm)
Re: [PATCH 0/6] Introduce commit notes, Junio C Hamano, (Mon Jul 16, 1:56 pm)
Re: [PATCH 0/6] Introduce commit notes, Johannes Schindelin, (Wed Jul 18, 9:34 pm)
[WIP PATCH 6/6] notes: add notes-index for a substantial spe..., Johannes Schindelin, (Sun Jul 15, 7:26 pm)
Re: [WIP PATCH 6/6] notes: add notes-index for a substantial..., Johannes Schindelin, (Mon Jul 16, 12:29 pm)
Re: [WIP PATCH 6/6] notes: add notes-index for a substantial..., Johannes Schindelin, (Sun Jul 15, 7:33 pm)
[PATCH 5/6] Document git-notes, Johannes Schindelin, (Sun Jul 15, 7:24 pm)
[PATCH 4/6] Add a test script for "git notes", Johannes Schindelin, (Sun Jul 15, 7:24 pm)
[PATCH 3/6] Add git-notes, Johannes Schindelin, (Sun Jul 15, 7:23 pm)
[PATCH 2/6] Introduce commit notes, Johannes Schindelin, (Sun Jul 15, 7:23 pm)
Re: [PATCH 2/6] Introduce commit notes, Junio C Hamano, (Sun Jul 15, 7:36 pm)
Re: [PATCH 2/6] Introduce commit notes, Junio C Hamano, (Sun Jul 15, 8:05 pm)
Re: [PATCH 2/6] Introduce commit notes, Johannes Schindelin, (Sun Jul 15, 7:52 pm)
[PATCH 1/6] Rename git_one_line() to git_line_length() and e..., Johannes Schindelin, (Sun Jul 15, 7:22 pm)
speck-geostationary