From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Subject: [PATCH v4 05/13] utf8.c: move display_mode_esc_sequence_len() for use by other functions Date: Fri, 19 Apr 2013 09:08:44 +1000 Message-ID: <1366326532-28517-6-git-send-email-pclouds@gmail.com> References: <1366100702-31745-1-git-send-email-pclouds@gmail.com> <1366326532-28517-1-git-send-email-pclouds@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Junio C Hamano , =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Fri Apr 19 01:09:46 2013 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1USxxY-0007Wl-1T for gcvg-git-2@plane.gmane.org; Fri, 19 Apr 2013 01:09:44 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967288Ab3DRXJk convert rfc822-to-quoted-printable (ORCPT ); Thu, 18 Apr 2013 19:09:40 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:34428 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966999Ab3DRXJj (ORCPT ); Thu, 18 Apr 2013 19:09:39 -0400 Received: by mail-pa0-f43.google.com with SMTP id hz11so1907171pad.16 for ; Thu, 18 Apr 2013 16:09:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=vaE85W+SLnp48+chFbC41Q0Ns7CNbnEmuRtqugRQTLY=; b=n6x46WBzhtvjmQVWSyEUuZZLBR2h+H6jxNcQTfXJIj4renfnBBx7wRewZVxsdvexTG Y8LhUSFFXMDejMunDxKe3geJIRoPC7mSe7QI4r6gqpITECJoAEaKnC8fCeX+ZR/Hp8Pn HOjcTPulHQGMIysAz6NeA5tZqX3gfwoKJ/8T5kXekaQ5HtkSgO3XCWbXj86nAoGRXJ60 /957g1EPLPxadLRmRpawRYlz/JVx/1sSrId6tBPaNcWjdwBopr0IJMlpO25c2tkfmuNU /SDr/5h+OkI3oGClN/PZiX/YkwmO2oATckZ+Or1a1WRS9MT7dzTuxyZLwn/mqpJU6vam JcLw== X-Received: by 10.66.84.74 with SMTP id w10mr2514933pay.214.1366326578484; Thu, 18 Apr 2013 16:09:38 -0700 (PDT) Received: from pclouds@gmail.com (dektec3.lnk.telstra.net. [165.228.202.174]) by mx.google.com with ESMTPS id vk7sm11157336pbc.41.2013.04.18.16.09.35 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 18 Apr 2013 16:09:37 -0700 (PDT) Received: by pclouds@gmail.com (sSMTP sendmail emulation); Fri, 19 Apr 2013 09:09:28 +1000 X-Mailer: git-send-email 1.8.2.82.gc24b958 In-Reply-To: <1366326532-28517-1-git-send-email-pclouds@gmail.com> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: Signed-off-by: Nguy=E1=BB=85n Th=C3=A1i Ng=E1=BB=8Dc Duy --- utf8.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/utf8.c b/utf8.c index 7f64857..6ed93c3 100644 --- a/utf8.c +++ b/utf8.c @@ -9,6 +9,20 @@ struct interval { int last; }; =20 +static size_t display_mode_esc_sequence_len(const char *s) +{ + const char *p =3D s; + if (*p++ !=3D '\033') + return 0; + if (*p++ !=3D '[') + return 0; + while (isdigit(*p) || *p =3D=3D ';') + p++; + if (*p++ !=3D 'm') + return 0; + return p - s; +} + /* auxiliary function for binary search in interval table */ static int bisearch(ucs_char_t ucs, const struct interval *table, int = max) { @@ -303,20 +317,6 @@ static void strbuf_add_indented_text(struct strbuf= *buf, const char *text, } } =20 -static size_t display_mode_esc_sequence_len(const char *s) -{ - const char *p =3D s; - if (*p++ !=3D '\033') - return 0; - if (*p++ !=3D '[') - return 0; - while (isdigit(*p) || *p =3D=3D ';') - p++; - if (*p++ !=3D 'm') - return 0; - return p - s; -} - /* * Wrap the text, if necessary. The variable indent is the indent for = the * first line, indent2 is the indent for all other lines. --=20 1.8.2.82.gc24b958