require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_RF__RF_DEBUGMEM_H_)) {
    eval 'sub _RF__RF_DEBUGMEM_H_ () {1;}' unless defined(&_RF__RF_DEBUGMEM_H_);
    require 'rf_alloclist.ph';
    if(defined(&_KERNEL)) {
	require 'sys/types.ph';
	require 'sys/malloc.ph';
	eval 'sub RF_Malloc {
	    my($_p_,$_size_,$_cast_) = @_;
    	    eval q( &do { $_p_ = $_cast_  &malloc($_size_,  &M_RAIDFRAME,  &M_WAITOK);  &bzero($_p_, $_size_);  &if ( &rf_memDebug)  &rf_record_malloc($_p_, $_size_,  &__LINE__,  &__FILE__); }  &while (0));
	}' unless defined(&RF_Malloc);
	eval 'sub RF_MallocAndAdd {
	    my($__p_,$__size_,$__cast_,$__alist_) = @_;
    	    eval q( &do {  &RF_Malloc($__p_, $__size_, $__cast_);  &if ($__alist_)  &rf_AddToAllocList($__alist_, $__p_, $__size_); }  &while (0));
	}' unless defined(&RF_MallocAndAdd);
	eval 'sub RF_Calloc {
	    my($_p_,$_nel_,$_elsz_,$_cast_) = @_;
    	    eval q( &RF_Malloc( $_p_, ($_nel_) * ($_elsz_), $_cast_););
	}' unless defined(&RF_Calloc);
	eval 'sub RF_CallocAndAdd {
	    my($__p,$__nel,$__elsz,$__cast,$__alist) = @_;
    	    eval q( &do {  &RF_Calloc($__p, $__nel, $__elsz, $__cast);  &if ($__alist)  &rf_AddToAllocList($__alist, $__p, ($__nel)*($__elsz)); }  &while (0));
	}' unless defined(&RF_CallocAndAdd);
	eval 'sub RF_Free {
	    my($_p_,$_sz_) = @_;
    	    eval q( &do {  &free(( &void *)($_p_),  &M_RAIDFRAME);  &if ( &rf_memDebug)  &rf_unrecord_malloc($_p_, ( &u_int32_t) ($_sz_)); }  &while (0));
	}' unless defined(&RF_Free);
    }
}
1;
