mirror of
https://github.com/RubyMetric/chsrc
synced 2025-12-25 11:59:54 +08:00
Fix the bug of wrong length in xy_log()
This commit is contained in:
4
helper.h
4
helper.h
@@ -81,8 +81,8 @@ xy_log (int level, const char* str)
|
||||
//xy_assert ("CAN'T REACH!");
|
||||
}
|
||||
|
||||
// -2 把中间%s减掉,-1 把末尾nul减掉
|
||||
size_t len = sizeof(color_fmt_str) -2 -1;
|
||||
// -2 把中间%s减掉
|
||||
size_t len = strlen(color_fmt_str) -2;
|
||||
char* buf = malloc(strlen(str) + len + 1);
|
||||
|
||||
sprintf (buf, color_fmt_str, str);
|
||||
|
||||
Reference in New Issue
Block a user