File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -1265,10 +1265,10 @@ xy_parent_dir (const char *path)
12651265 char * dir = xy_normalize_path (path );
12661266
12671267 /* 不管是否为Windows,全部统一使用 / 作为路径分隔符,方便后续处理 */
1268- dir = xy_str_gsub (dir , "\\" , "/" );
1268+ xy_str_swap ( & dir , xy_str_gsub (dir , "\\" , "/" ) );
12691269
12701270 if (xy_str_end_with (dir , "/" ))
1271- dir = xy_str_delete_suffix (dir , "/" );
1271+ xy_str_swap ( & dir , xy_str_delete_suffix (dir , "/" ) );
12721272
12731273 char * last = NULL ;
12741274
@@ -1282,9 +1282,10 @@ xy_parent_dir (const char *path)
12821282
12831283 /* Windows上重新使用 \ 作为路径分隔符 */
12841284 if (xy .on_windows )
1285- return xy_str_gsub (dir , "/" , "\\" );
1286- else
1287- return dir ;
1285+ {
1286+ xy_str_swap (& dir , xy_str_gsub (dir , "/" , "\\" ));
1287+ }
1288+ return dir ;
12881289}
12891290
12901291
You can’t perform that action at this time.
0 commit comments