Skip to content

Commit 4247fe7

Browse files
pcloudsgitster
authored andcommitted
utf8.c: move display_mode_esc_sequence_len() for use by other functions
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9d3f002 commit 4247fe7

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

utf8.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,20 @@ struct interval {
99
int last;
1010
};
1111

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+
1226
/* auxiliary function for binary search in interval table */
1327
static int bisearch(ucs_char_t ucs, const struct interval *table, int max)
1428
{
@@ -303,20 +317,6 @@ static void strbuf_add_indented_text(struct strbuf *buf, const char *text,
303317
}
304318
}
305319

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-
320320
/*
321321
* Wrap the text, if necessary. The variable indent is the indent for the
322322
* first line, indent2 is the indent for all other lines.

0 commit comments

Comments
 (0)