?? rmmmimplementation.c
字號:
/***************************************** Copyright 2001-2003 Sigma Designs, Inc. All Rights Reserved Proprietary and Confidential *****************************************//** @file rmmm.c @brief @author Christian Wolff @date 2003-04-03*/#include <stdio.h>#include <stdlib.h>#include <string.h>#include <time.h>#define ALLOW_OS_CODE 1#include "rmdef/rmdef.h"#define RM_UPPERSTYLE#define MALLOC_DEBUG//#include "rmalloc.h"RMuint32 mem_status = 0;//#ifdef WITH_MONO//#if 1// #include "rmmemorymanager/include/rmmmhomemade.h"// #include "rmlibcw/include/rmcriticalsections.h"//// struct mz *pZ0 = (struct mz *) NULL;// void *RMMalloc(RMuint32 size) {// void * p = RMMallocInZone(NULL,pZ0,size);// return p;// }// void RMFree(void *ptr) { RMFreeInZone(NULL,pZ0,ptr); }// void *RMCalloc(RMuint32 nmemb,RMuint32 size) { return RMCallocInZone(NULL,pZ0,nmemb,size); }// void *RMMemset(void *s, RMuint8 c, RMuint32 n) { return RMMemsetInZone(NULL,pZ0,s,c,n); }// void *RMMemcpy(void *dest, const void *src, RMuint32 n) { return RMMemcpyInZone(NULL,pZ0,dest,src,n); }// RMint32 RMMemcmp(const void *s1, const void *s2, RMuint32 n) { return RMMemcmpInZone(NULL,pZ0,s1,s2,n); }//// #ifdef WITH_THREADS// void mzlock(void *mac,void *cookie) { RMEnterCriticalSection((RMcriticalsection)cookie); }// void mzunlock(void *mac,void *cookie) { RMLeaveCriticalSection((RMcriticalsection)cookie); }// #endif//#endif//#else//#ifdef RM_UPPERSTYLE///* Deprecated: Only used for backward compatibility: *///# define RMMalloc(s) Rmalloc((s), RM_FILE_POS)//# define RMCalloc(n,s) Rcalloc((n), (s), RM_FILE_POS)//# define RMRealloc(p,s) Rrealloc((p), (s), RM_FILE_POS)//# define RMFree(p) Rfree((p), RM_FILE_POS)//# define RMFree0(p) Rfree((p), RM_FILE_POS),(p)=NULL//# define STRDUP(s) Rstrdup((s), RM_FILE_POS)//#endifinline void *RMMalloc(RMuint32 size){ mem_status ++; return Rmalloc(size, RM_FILE_POS);}inline void RMFree(void *ptr){ mem_status --; Rfree(ptr, RM_FILE_POS);}inline void *RMMemset(void *s, RMuint8 c, RMuint32 n){ return memset(s, c, n);}inline void *RMMemcpy(void *dest, const void *src, RMuint32 n){ return memcpy(dest, src, n);}inline RMint32 RMMemcmp(const void *s1, const void *s2, RMuint32 n){ return memcmp(s1, s2, n);}////inline void *RMCalloc(RMuint32 nmemb, RMuint32 size)////{//// void *ptr = RMMalloc(nmemb * size);//// if (ptr != NULL) RMMemset(ptr, 0, nmemb * size);//// return ptr;////}//inline void *RMCalloc(RMuint32 nmemb, RMuint32 size){ return Rcalloc(nmemb, size, RM_FILE_POS);}#ifdef WITH_THREADS#include "rmlibcw/include/rmlibcw.h"void mzlock(void *mac,void *cookie);void mzunlock(void *mac,void *cookie);void mzlock(void *mac,void *cookie) { RMEnterCriticalSection((RMcriticalsection)cookie); }void mzunlock(void *mac,void *cookie) { RMLeaveCriticalSection((RMcriticalsection)cookie); }#endif // WITH_THREADS//#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -