From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bo Yang Subject: [PATCH v3 06/13] export three functions from diff.c Date: Sun, 11 Jul 2010 14:18:54 +0800 Message-ID: <1278829141-11900-6-git-send-email-struggleyb.nku@gmail.com> References: <1278829141-11900-1-git-send-email-struggleyb.nku@gmail.com> Cc: gitster@pobox.com To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Sun Jul 11 08:21:35 2010 Return-path: Envelope-to: gcvg-git-2@lo.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OXpuv-00021P-CH for gcvg-git-2@lo.gmane.org; Sun, 11 Jul 2010 08:21:33 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751523Ab0GKGVa (ORCPT ); Sun, 11 Jul 2010 02:21:30 -0400 Received: from mail-pz0-f46.google.com ([209.85.210.46]:58225 "EHLO mail-pz0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750979Ab0GKGV2 (ORCPT ); Sun, 11 Jul 2010 02:21:28 -0400 Received: by mail-pz0-f46.google.com with SMTP id 26so808174pzk.19 for ; Sat, 10 Jul 2010 23:21:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=IAXr5F0JtMCSAyaN0pcp36uvrFLS2qv76K6BkhnpDIM=; b=XFp0DyjBbqgznE3KzkoMrC8YOhvt4/IlfslHI0zSJ5cnnros5Ggf92Ccd7i53XapQg 63/MTmu7I/cnd1+sS1R3ieCGvZnla1E6qATGuyq2JyI4EYlf2lDxIKf6oAls0eRhzaAc hX+/HnF+Jc7E6vkGMQGBRWs/a4JRDw5fHiZ54= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=VWg7t0hzGyEwIKXkmVz4gdDZ3hsqY5vT8aE6xTQCUuz1eDfUONvcmqfu33Yw52lnJJ BRdpFFPh+7Sgvx/Fb8Yiu/OoYxSt/aHEOE2FBiyo0OHRsOKp7mW4FYZMUQh8cS5Uwz3J wuTOQS4RUkHq16tYGjkSMzA9rO+DNBHX0Iofw= Received: by 10.142.142.15 with SMTP id p15mr11226977wfd.208.1278829287997; Sat, 10 Jul 2010 23:21:27 -0700 (PDT) Received: from localhost.localdomain ([222.35.175.242]) by mx.google.com with ESMTPS id c15sm2927911rvi.11.2010.07.10.23.21.24 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 10 Jul 2010 23:21:27 -0700 (PDT) X-Mailer: git-send-email 1.7.2.rc2.18.g2bc49 In-Reply-To: <1278829141-11900-1-git-send-email-struggleyb.nku@gmail.com> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: Use fill_metainfo to fill the line level diff meta data, emit_line to print out a line and quote_two to quote paths. Signed-off-by: Bo Yang --- diff.c | 6 +++--- diff.h | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/diff.c b/diff.c index 3aa695d..d685f5a 100644 --- a/diff.c +++ b/diff.c @@ -144,7 +144,7 @@ int git_diff_basic_config(const char *var, const char *value, void *cb) return git_color_default_config(var, value, cb); } -static char *quote_two(const char *one, const char *two) +char *quote_two(const char *one, const char *two) { int need_one = quote_c_style(one, NULL, NULL, 1); int need_two = quote_c_style(two, NULL, NULL, 1); @@ -325,7 +325,7 @@ static void emit_line_0(struct diff_options *o, const char *set, const char *res fputc('\n', file); } -static void emit_line(struct diff_options *o, const char *set, const char *reset, +void emit_line(struct diff_options *o, const char *set, const char *reset, const char *line, int len) { emit_line_0(o, set, reset, line[0], line+1, len-1); @@ -2564,7 +2564,7 @@ static int similarity_index(struct diff_filepair *p) return p->score * 100 / MAX_SCORE; } -static void fill_metainfo(struct strbuf *msg, +void fill_metainfo(struct strbuf *msg, const char *name, const char *other, struct diff_filespec *one, diff --git a/diff.h b/diff.h index 063d10a..9676ab9 100644 --- a/diff.h +++ b/diff.h @@ -12,6 +12,7 @@ struct diff_queue_struct; struct strbuf; struct diff_filespec; struct userdiff_driver; +struct diff_filepair; typedef void (*change_fn_t)(struct diff_options *options, unsigned old_mode, unsigned new_mode, @@ -301,4 +302,20 @@ extern size_t fill_textconv(struct userdiff_driver *driver, extern struct userdiff_driver *get_textconv(struct diff_filespec *one); +/* some output functions line.c need */ +extern void fill_metainfo(struct strbuf *msg, + const char *name, + const char *other, + struct diff_filespec *one, + struct diff_filespec *two, + struct diff_options *o, + struct diff_filepair *p, + int *must_show_header, + int use_color); + +extern void emit_line(struct diff_options *o, const char *set, const char *reset, + const char *line, int len); + +extern char *quote_two(const char *one, const char *two); + #endif /* DIFF_H */ -- 1.7.0.2.273.gc2413.dirty