git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Alberto Bertogli <albertito@gmail.com>,
	git@vger.kernel.org, gitster@pobox.com,
	Johan Herland <johan@herland.net>
Subject: [PATCH 1/6] Rename git_one_line() to git_line_length() and export it
Date: Mon, 16 Jul 2007 00:22:00 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0707160021390.14781@racer.site> (raw)
In-Reply-To: <Pine.LNX.4.64.0707152326080.14781@racer.site>


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

  reply	other threads:[~2007-07-15 23:22 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-15 23:19 [PATCH 0/6] Introduce commit notes Johannes Schindelin
2007-07-15 23:22 ` Johannes Schindelin [this message]
2007-07-15 23:23 ` [PATCH 2/6] " Johannes Schindelin
2007-07-15 23:36   ` Junio C Hamano
2007-07-15 23:52     ` Johannes Schindelin
2007-07-16  0:05     ` Junio C Hamano
2007-07-16  5:11   ` Junio C Hamano
2007-07-19  2:30     ` [REVISED PATCH " Johannes Schindelin
2007-07-19  3:28       ` Linus Torvalds
2007-07-19  5:13         ` Junio C Hamano
2007-07-19  9:34           ` Junio C Hamano
2007-07-19  9:57             ` Adam Hayek
2007-07-19 10:58             ` Andy Parkins
2007-07-19 11:10               ` Johannes Schindelin
2007-07-19 14:33                 ` Andy Parkins
2007-07-19 17:42             ` Linus Torvalds
2007-07-20  0:20               ` Junio C Hamano
2007-07-20  4:59             ` Shawn O. Pearce
2007-07-19 17:20           ` Linus Torvalds
2007-07-19  9:50         ` Johannes Schindelin
2007-07-19 10:34         ` Olivier Galibert
2007-07-19 17:50           ` Linus Torvalds
2007-07-19  9:05       ` Wincent Colaiuta
2007-07-19  9:24         ` Johannes Schindelin
2007-07-19  9:54       ` Sven Verdoolaege
2007-07-15 23:23 ` [PATCH 3/6] Add git-notes Johannes Schindelin
2007-07-16  5:11   ` Junio C Hamano
2007-07-19  2:31     ` [REVISED PATCH " Johannes Schindelin
2007-07-19  2:54       ` Johannes Schindelin
2007-07-15 23:24 ` [PATCH 4/6] Add a test script for "git notes" Johannes Schindelin
2007-07-16  5:11   ` Junio C Hamano
2007-07-19  2:32     ` [REVISED PATCH " Johannes Schindelin
2007-07-15 23:24 ` [PATCH 5/6] Document git-notes Johannes Schindelin
2007-07-15 23:26 ` [WIP PATCH 6/6] notes: add notes-index for a substantial speedup Johannes Schindelin
2007-07-15 23:33   ` Johannes Schindelin
2007-07-16  6:01   ` Shawn O. Pearce
2007-07-16 16:29     ` Johannes Schindelin
2007-07-16  7:57 ` [PATCH 0/6] Introduce commit notes Andy Parkins
2007-07-16  8:11   ` Junio C Hamano
2007-07-16 16:26     ` Johannes Schindelin
2007-07-16 17:56       ` Junio C Hamano
2007-07-19  1:34         ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0707160021390.14781@racer.site \
    --to=johannes.schindelin@gmx.de \
    --cc=albertito@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johan@herland.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).