mruby-io (mrb_file_realpath): use mrb_str_cat instead of mrb_str_append

This commit is contained in:
Yukihiro "Matz" Matsumoto
2025-03-20 22:04:49 +09:00
parent 5bc391e170
commit 90d4805f5b
+3 -3
View File
@@ -279,10 +279,10 @@ static mrb_value
mrb_file_realpath(mrb_state *mrb, mrb_value klass)
{
mrb_value pathname, dir_string;
mrb_int argc = mrb_get_args(mrb, "S|S", &pathname, &dir_string);
if (argc == 2) {
if (mrb_get_args(mrb, "S|S", &pathname, &dir_string) == 2) {
mrb_value s = mrb_str_dup(mrb, dir_string);
s = mrb_str_append(mrb, s, mrb_str_new_cstr(mrb, FILE_SEPARATOR));
s = mrb_str_cat_cstr(mrb, s, FILE_SEPARATOR);
s = mrb_str_append(mrb, s, pathname);
pathname = s;
}