Substite with NIL_OR_UNDEF_P more

This commit is contained in:
Nobuyoshi Nakada committed 2026-10-11 22:40:45 +09:00
1 parent 8264d60f97
commit 9cffa03aef
4 files changed
+6 -6
Notes: git 2026-10-11 14:36:33 +00:00

No files matched your search

+1 -1
View File
@@ -7053,7 +7053,7 @@ rb_io_extract_encoding_option(VALUE opt, rb_encoding **enc_p, rb_encoding **enc2
}
encoding = Qnil;
}
if (!UNDEF_P(extenc) && !NIL_P(extenc)) {
if (!NIL_OR_UNDEF_P(extenc)) {
extencoding = rb_to_encoding(extenc);
}
if (!UNDEF_P(intenc)) {
+1 -1
View File
@@ -840,7 +840,7 @@ rb_obj_inspect(VALUE obj)
{
VALUE ivars = rb_check_funcall(obj, id_instance_variables_to_inspect, 0, 0);
st_index_t n = 0;
if (UNDEF_P(ivars) || NIL_P(ivars)) {
if (NIL_OR_UNDEF_P(ivars)) {
n = rb_ivar_count(obj);
ivars = Qnil;
}
+2 -2
View File
@@ -2155,10 +2155,10 @@ rb_str_init(int argc, VALUE *argv, VALUE str)
rb_get_kwargs(opt, keyword_ids, 0, 2, kwargs);
venc = kwargs[0];
vcapa = kwargs[1];
if (!UNDEF_P(venc) && !NIL_P(venc)) {
if (!NIL_OR_UNDEF_P(venc)) {
enc = rb_to_encoding(venc);
}
if (!UNDEF_P(vcapa) && !NIL_P(vcapa)) {
if (!NIL_OR_UNDEF_P(vcapa)) {
rb_len_t capa = NUM2LEN(vcapa);
rb_len_t len = 0;
int termlen = enc ? rb_enc_mbminlen(enc) : 1;
+2 -2
View File
@@ -2367,7 +2367,7 @@ transcode_loop_fallback_try(VALUE a)
VALUE ret = args->fallback_func(args->fallback, args->rep);
if (!UNDEF_P(ret) && !NIL_P(ret)) {
if (!NIL_OR_UNDEF_P(ret)) {
StringValue(ret);
}
@@ -2450,7 +2450,7 @@ transcode_loop(const unsigned char **in_pos, unsigned char **out_pos,
rb_raise(rb_eRuntimeError, "string modified");
}
if (!UNDEF_P(rep) && !NIL_P(rep)) {
if (!NIL_OR_UNDEF_P(rep)) {
ret = rb_econv_insert_output(ec, (const unsigned char *)RSTRING_PTR(rep),
RSTRING_LEN(rep), rb_enc_name(rb_enc_get(rep)));
RB_GC_GUARD(rep); // insert_output may GC while reading rep's bytes