/*
 * call-seq:
 *   prc == other_proc   =>  true or false
 *
 * Return <code>true</code> if <i>prc</i> is the same object as
 * <i>other_proc</i>, or if they are both procs with the same body.
 */

static VALUE
proc_eq(VALUE self, VALUE other)
{
    if (self == other) {
        return Qtrue;
    }
    else {
        if (TYPE(other)          == T_DATA &&
            RBASIC(other)->klass == rb_cProc &&
            CLASS_OF(self)       == CLASS_OF(other)) {
            rb_proc_t *p1, *p2;
            GetProcPtr(self, p1);
            GetProcPtr(other, p2);
            if (p1->block.iseq == p2->block.iseq && p1->envval == p2->envval) {
                return Qtrue;
            }
        }
    }
    return Qfalse;
}