kgio.git  about / heads / tags
kinder, gentler I/O for Ruby
blob 46603f1fa0494add100caf05e12adbedbe0393d7 711 bytes (raw)
$ git show rbx-wip:ext/kgio/set_file_path.h	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 
/* We do not modify RSTRING in this file, so RSTRING_MODIFIED is not needed */
#if defined(HAVE_RB_IO_T) && \
    defined(HAVE_TYPE_STRUCT_RFILE) && \
    defined(HAVE_ST_PATHV)
/* MRI 1.9 */
static void set_file_path(VALUE io, VALUE path)
{
	rb_io_t *fptr = RFILE(io)->fptr;
	fptr->pathv = rb_str_new4(path);
}
#elif defined(HAVE_TYPE_OPENFILE) && \
      defined(HAVE_TYPE_STRUCT_RFILE) && \
      defined(HAVE_ST_PATH)
/* MRI 1.8 */
#include "util.h"
static void set_file_path(VALUE io, VALUE path)
{
	OpenFile *fptr = RFILE(io)->fptr;
	fptr->path = ruby_strdup(RSTRING_PTR(path));
}
#else
/* Rubinius */
static void set_file_path(VALUE io, VALUE path)
{
	rb_iv_set(io, "@path", rb_str_new4(path));
}
#endif

git clone git://yhbt.net/kgio.git
git clone https://yhbt.net/kgio.git