Skip to content

Commit bf75ccb

Browse files
guohengccmywish
authored andcommitted
Fix bug to make.Reason is goto
1 parent 6152c7f commit bf75ccb

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

lib/xy.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,8 @@ static char *
473473
_xy_str_to_terminal_style (int style, const char *str)
474474
{
475475
char *color_fmt_str = NULL;
476+
size_t len;
477+
char *buf;
476478

477479
if (!xy.enable_color)
478480
{
@@ -511,8 +513,8 @@ _xy_str_to_terminal_style (int style, const char *str)
511513

512514
new_str:
513515
// -2 把中间%s减掉
514-
size_t len = strlen (color_fmt_str) - 2;
515-
char *buf = malloc (strlen (str) + len + 1);
516+
len = strlen (color_fmt_str) - 2;
517+
buf = malloc (strlen (str) + len + 1);
516518
sprintf (buf, color_fmt_str, str);
517519
return buf;
518520
}

0 commit comments

Comments
 (0)