utf8.c: move display_mode_esc_sequence_len() for use by other functions

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Apr 19, 2013 at 09:08 UTC 4247fe79567fed2c9f896e2cc20246d71d8a33a2
1 file changed +14 -14
utf8.c
+14 -14
@@ -9,6 +9,20 @@ struct interval {
9 int last;
10 };
11
12 +static size_t display_mode_esc_sequence_len(const char *s)
13 +{
14 + const char *p = s;
15 + if (*p++ != '\033')
16 + return 0;
17 + if (*p++ != '[')
18 + return 0;
19 + while (isdigit(*p) || *p == ';')
20 + p++;
21 + if (*p++ != 'm')
22 + return 0;
23 + return p - s;
24 +}
25 +
26 /* auxiliary function for binary search in interval table */
27 static int bisearch(ucs_char_t ucs, const struct interval *table, int max)
28 {
@@ -303,20 +317,6 @@ static void strbuf_add_indented_text(struct strbuf *buf, const char *text,
317 }
318 }
319
306 -static size_t display_mode_esc_sequence_len(const char *s)
307 -{
308 - const char *p = s;
309 - if (*p++ != '\033')
310 - return 0;
311 - if (*p++ != '[')
312 - return 0;
313 - while (isdigit(*p) || *p == ';')
314 - p++;
315 - if (*p++ != 'm')
316 - return 0;
317 - return p - s;
318 -}
319 -
320 /*
321 * Wrap the text, if necessary. The variable indent is the indent for the
322 * first line, indent2 is the indent for all other lines.