]> git.wincent.com - mkdtemp.git/commitdiff
Avoid unnecessary reallocation in mkdtemp function
authorWincent Colaiuta <win@wincent.com>
Sat, 27 Sep 2008 16:40:05 +0000 (18:40 +0200)
committerWincent Colaiuta <win@wincent.com>
Sat, 27 Sep 2008 16:40:05 +0000 (18:40 +0200)
Signed-off-by: Wincent Colaiuta <win@wincent.com>
ext/mkdtemp.c

index 822b299d54ef41050011aa49a4fefc48363b4e57..8ce25f1194882436b9f6dea7d4926ffbed1334b2 100644 (file)
@@ -40,7 +40,7 @@ static VALUE walrus_dir_mkdtemp_m(int argc, VALUE *argv, VALUE self)
     char *path  = mkdtemp(RSTRING(safe)->ptr);
     if (path == NULL)
         rb_raise(rb_eSystemCallError, "mkdtemp failed (error: %d)", errno);
-    return rb_str_new2(path);
+    return safe;
 }
 
 void Init_mkdtemp()