Prefer 0
over NULL
as function pointers
SunC warns use of `NULL`, pointer to data as function pointers.
This commit is contained in:
parent
52f8de4f21
commit
b934976024
Notes:
git
2023-06-22 18:16:14 +00:00
Merged: https://github.com/ruby/ruby/pull/7972 Merged-By: nobu <nobu@ruby-lang.org>
2
class.c
2
class.c
@ -249,7 +249,7 @@ class_alloc(VALUE flags, VALUE klass)
|
|||||||
*/
|
*/
|
||||||
RCLASS_SET_ORIGIN((VALUE)obj, (VALUE)obj);
|
RCLASS_SET_ORIGIN((VALUE)obj, (VALUE)obj);
|
||||||
RB_OBJ_WRITE(obj, &RCLASS_REFINED_CLASS(obj), Qnil);
|
RB_OBJ_WRITE(obj, &RCLASS_REFINED_CLASS(obj), Qnil);
|
||||||
RCLASS_SET_ALLOCATOR((VALUE)obj, NULL);
|
RCLASS_SET_ALLOCATOR((VALUE)obj, 0);
|
||||||
|
|
||||||
return (VALUE)obj;
|
return (VALUE)obj;
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ static inline rb_alloc_func_t
|
|||||||
RCLASS_ALLOCATOR(VALUE klass)
|
RCLASS_ALLOCATOR(VALUE klass)
|
||||||
{
|
{
|
||||||
if (FL_TEST_RAW(klass, FL_SINGLETON)) {
|
if (FL_TEST_RAW(klass, FL_SINGLETON)) {
|
||||||
return NULL;
|
return 0;
|
||||||
}
|
}
|
||||||
return RCLASS_EXT(klass)->as.class.allocator;
|
return RCLASS_EXT(klass)->as.class.allocator;
|
||||||
}
|
}
|
||||||
|
2
ractor.c
2
ractor.c
@ -648,7 +648,7 @@ ractor_sleep_with_cleanup(rb_execution_context_t *ec, rb_ractor_t *cr, enum rb_r
|
|||||||
static enum rb_ractor_wakeup_status
|
static enum rb_ractor_wakeup_status
|
||||||
ractor_sleep(rb_execution_context_t *ec, rb_ractor_t *cr, enum rb_ractor_wait_status wait_status)
|
ractor_sleep(rb_execution_context_t *ec, rb_ractor_t *cr, enum rb_ractor_wait_status wait_status)
|
||||||
{
|
{
|
||||||
return ractor_sleep_with_cleanup(ec, cr, wait_status, NULL, NULL);
|
return ractor_sleep_with_cleanup(ec, cr, wait_status, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ractor.receive
|
// Ractor.receive
|
||||||
|
2
struct.c
2
struct.c
@ -1871,7 +1871,7 @@ rb_data_with(int argc, const VALUE *argv, VALUE self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
VALUE h = rb_struct_to_h(self);
|
VALUE h = rb_struct_to_h(self);
|
||||||
rb_hash_update_by(h, kwargs, NULL);
|
rb_hash_update_by(h, kwargs, 0);
|
||||||
return rb_class_new_instance_kw(1, &h, rb_obj_class(self), TRUE);
|
return rb_class_new_instance_kw(1, &h, rb_obj_class(self), TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
time.c
2
time.c
@ -5828,7 +5828,7 @@ Init_Time(void)
|
|||||||
|
|
||||||
if (debug_find_time_numguess) {
|
if (debug_find_time_numguess) {
|
||||||
rb_define_hooked_variable("$find_time_numguess", (VALUE *)&find_time_numguess,
|
rb_define_hooked_variable("$find_time_numguess", (VALUE *)&find_time_numguess,
|
||||||
find_time_numguess_getter, NULL);
|
find_time_numguess_getter, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
rb_cTimeTM = Init_tm(rb_cTime, "tm");
|
rb_cTimeTM = Init_tm(rb_cTime, "tm");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user