[前][次][番号順一覧][スレッド一覧]

ruby-changes:58642

From: Koichi <ko1@a...>
Date: Fri, 8 Nov 2019 16:17:53 +0900 (JST)
Subject: [ruby-changes:58642] 83c563cfa4 (master): cstr -> bytes

https://git.ruby-lang.org/ruby.git/commit/?id=83c563cfa4

From 83c563cfa403af1141fc0080d2b6eec344db6726 Mon Sep 17 00:00:00 2001
From: Koichi Sasada <ko1@a...>
Date: Fri, 8 Nov 2019 16:16:25 +0900
Subject: cstr -> bytes

rb_iseq_ibf_load_cstr() accepts bytes, but not NUL-terminate
C string. To make it clear, rename it to _bytes.

diff --git a/builtin.c b/builtin.c
index 44471f0..bcc5dc6 100644
--- a/builtin.c
+++ b/builtin.c
@@ -26,7 +26,7 @@ rb_load_with_builtin_functions(const char *feature_name, const char *fname, cons https://github.com/ruby/ruby/blob/trunk/builtin.c#L26
 
     // load binary
     GET_VM()->builtin_function_table = table;
-    const rb_iseq_t *iseq = rb_iseq_ibf_load_cstr((const char *)bin, size);
+    const rb_iseq_t *iseq = rb_iseq_ibf_load_bytes((const char *)bin, size);
     GET_VM()->builtin_function_table = NULL;
 
     // exec
diff --git a/compile.c b/compile.c
index b9106d2..1f4031a 100644
--- a/compile.c
+++ b/compile.c
@@ -11426,10 +11426,10 @@ ibf_load_iseq(const struct ibf_load *load, const rb_iseq_t *index_iseq) https://github.com/ruby/ruby/blob/trunk/compile.c#L11426
 }
 
 static void
-ibf_load_setup_cstr(struct ibf_load *load, VALUE loader_obj, const char *cstr, size_t size)
+ibf_load_setup_bytes(struct ibf_load *load, VALUE loader_obj, const char *bytes, size_t size)
 {
     load->loader_obj = loader_obj;
-    load->global_buffer.buff = cstr;
+    load->global_buffer.buff = bytes;
     load->header = (struct ibf_header *)load->global_buffer.buff;
     load->global_buffer.size = load->header->size;
     load->global_buffer.obj_list_offset = load->header->global_object_list_offset;
@@ -11478,7 +11478,7 @@ ibf_load_setup(struct ibf_load *load, VALUE loader_obj, VALUE str) https://github.com/ruby/ruby/blob/trunk/compile.c#L11478
     str = rb_str_new(RSTRING_PTR(str), RSTRING_LEN(str));
 #endif
 
-    ibf_load_setup_cstr(load, loader_obj, StringValuePtr(str), RSTRING_LEN(str));
+    ibf_load_setup_bytes(load, loader_obj, StringValuePtr(str), RSTRING_LEN(str));
     RB_OBJ_WRITE(loader_obj, &load->str, str);
 }
 
@@ -11525,13 +11525,13 @@ rb_iseq_ibf_load(VALUE str) https://github.com/ruby/ruby/blob/trunk/compile.c#L11525
 }
 
 const rb_iseq_t *
-rb_iseq_ibf_load_cstr(const char *cstr, size_t size)
+rb_iseq_ibf_load_bytes(const char *bytes, size_t size)
 {
     struct ibf_load *load;
     rb_iseq_t *iseq;
     VALUE loader_obj = TypedData_Make_Struct(0, struct ibf_load, &ibf_load_type, load);
 
-    ibf_load_setup_cstr(load, loader_obj, cstr, size);
+    ibf_load_setup_bytes(load, loader_obj, bytes, size);
     iseq = ibf_load_iseq(load, 0);
 
     RB_GC_GUARD(loader_obj);
diff --git a/iseq.h b/iseq.h
index 5e4f245..c9cc125 100644
--- a/iseq.h
+++ b/iseq.h
@@ -156,7 +156,7 @@ iseq_imemo_alloc(void) https://github.com/ruby/ruby/blob/trunk/iseq.h#L156
 VALUE rb_iseq_ibf_dump(const rb_iseq_t *iseq, VALUE opt);
 void rb_ibf_load_iseq_complete(rb_iseq_t *iseq);
 const rb_iseq_t *rb_iseq_ibf_load(VALUE str);
-const rb_iseq_t *rb_iseq_ibf_load_cstr(const char *cstr, size_t);
+const rb_iseq_t *rb_iseq_ibf_load_bytes(const char *cstr, size_t);
 VALUE rb_iseq_ibf_load_extra_data(VALUE str);
 void rb_iseq_init_trace(rb_iseq_t *iseq);
 int rb_iseq_add_local_tracepoint_recursively(const rb_iseq_t *iseq, rb_event_flag_t turnon_events, VALUE tpval, unsigned int target_line);
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]