Method: FFI::Pointer#==

Defined in:
ext/ffi_c/Pointer.c

#==(other) ⇒ Object

Check equality between self and other. Equality is tested on #address.

Parameters:



304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
# File 'ext/ffi_c/Pointer.c', line 304

static VALUE
ptr_equals(VALUE self, VALUE other)
{
    Pointer* ptr;

    TypedData_Get_Struct(self, Pointer, &rbffi_pointer_data_type, ptr);

    if (NIL_P(other)) {
        return ptr->memory.address == NULL ? Qtrue : Qfalse;
    }

    if (!rb_obj_is_kind_of(other, rbffi_PointerClass)) {
        return Qfalse;
    }
    else {
        return ptr->memory.address == POINTER(other)->address ? Qtrue : Qfalse;
    }
}