mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Eliminate internal uses of Data_Wrap_Struct
Ref: https://github.com/ruby/ruby/pull/10872 These should be the last internal uses of the old `Data` API inside Ruby itself. Some use remain in a couple default gems.
This commit is contained in:
parent
730e3b2ce0
commit
7c12169230
6 changed files with 122 additions and 56 deletions
11
dir.c
11
dir.c
|
@ -113,6 +113,7 @@ char *strchr(char*,char);
|
|||
#include "internal/gc.h"
|
||||
#include "internal/io.h"
|
||||
#include "internal/object.h"
|
||||
#include "internal/imemo.h"
|
||||
#include "internal/vm.h"
|
||||
#include "ruby/encoding.h"
|
||||
#include "ruby/ruby.h"
|
||||
|
@ -1389,19 +1390,15 @@ rb_dir_getwd_ospath(void)
|
|||
VALUE cwd;
|
||||
VALUE path_guard;
|
||||
|
||||
#undef RUBY_UNTYPED_DATA_WARNING
|
||||
#define RUBY_UNTYPED_DATA_WARNING 0
|
||||
path_guard = Data_Wrap_Struct((VALUE)0, NULL, RUBY_DEFAULT_FREE, NULL);
|
||||
path_guard = rb_imemo_tmpbuf_auto_free_pointer();
|
||||
path = ruby_getcwd();
|
||||
DATA_PTR(path_guard) = path;
|
||||
rb_imemo_tmpbuf_set_ptr(path_guard, path);
|
||||
#ifdef __APPLE__
|
||||
cwd = rb_str_normalize_ospath(path, strlen(path));
|
||||
#else
|
||||
cwd = rb_str_new2(path);
|
||||
#endif
|
||||
DATA_PTR(path_guard) = 0;
|
||||
|
||||
xfree(path);
|
||||
rb_free_tmp_buffer(&path_guard);
|
||||
return cwd;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue