mirror of
https://gitee.com/RubyMetric/chsrc.git
synced 2025-12-26 05:02:46 +00:00
修复 xy_str_delete_prefix 误释放的问题
This commit is contained in:
parent
547931c4e4
commit
5588beb542
9
lib/xy.h
9
lib/xy.h
|
|
@ -583,12 +583,11 @@ xy_str_delete_prefix (const char *str, const char *prefix)
|
|||
{
|
||||
char *new = xy_strdup (str);
|
||||
bool yes = xy_str_start_with (str, prefix);
|
||||
if (!yes)
|
||||
return new;
|
||||
|
||||
if (!yes) return new;
|
||||
size_t len = strlen (prefix);
|
||||
char *cur = new + len;
|
||||
return cur;
|
||||
char *ret = xy_strdup (new + len);
|
||||
free (new);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue