📄 dmalloc.h
字号:
#undef memalign#define memalign(alignment, size) \ _memalign_leap(__FILE__, __LINE__, alignment, size)#undef valloc#define valloc(size) \ _valloc_leap(__FILE__, __LINE__, size)#ifndef DMALLOC_STRDUP_MACRO#undef strdup#define strdup(str) \ _strdup_leap(__FILE__, __LINE__, str)#endif#undef free#define free(ptr) \ _free_leap(__FILE__, __LINE__, ptr)#undef xmalloc#define xmalloc(size) \ _xmalloc_leap(__FILE__, __LINE__, size)#undef xcalloc#define xcalloc(count, size) \ _xcalloc_leap(__FILE__, __LINE__, count, size)#undef xrealloc#define xrealloc(ptr, size) \ _xrealloc_leap(__FILE__, __LINE__, ptr, size)#undef xrecalloc#define xrecalloc(ptr, size) \ _xrecalloc_leap(__FILE__, __LINE__, ptr, size)#undef xmemalign#define xmemalign(alignment, size) \ _xmemalign_leap(__FILE__, __LINE__, alignment, size)#undef xvalloc#define xvalloc(size) \ _xvalloc_leap(__FILE__, __LINE__, size)#undef xstrdup#define xstrdup(str) \ _xstrdup_leap(__FILE__, __LINE__, str)#undef xfree#define xfree(ptr) \ _xfree_leap(__FILE__, __LINE__, ptr)#ifdef DMALLOC_FUNC_CHECK/* * do debugging on the following functions. this may cause compilation or * other problems depending on your architecture. */#undef bcmp#define bcmp(b1, b2, len) _dmalloc_bcmp(b1, b2, len)#undef bcopy#define bcopy(from, to, len) _dmalloc_bcopy(from, to, len)#undef memcmp#define memcmp(b1, b2, len) _dmalloc_memcmp(b1, b2, len)#undef memcpy#define memcpy(to, from, len) _dmalloc_memcpy(to, from, len)#undef memset#define memset(buf, ch, len) _dmalloc_memset(buf, ch, len)#undef index#define index(str, ch) _dmalloc_index(str, ch)#undef rindex#define rindex(str, ch) _dmalloc_rindex(str, ch)#undef strcat#define strcat(to, from) _dmalloc_strcat(to, from)#undef strcmp#define strcmp(s1, s2) _dmalloc_strcmp(s1, s2)#undef strlen#define strlen(str) _dmalloc_strlen(str)#undef strtok#define strtok(str, sep) _dmalloc_strtok(str, sep)#undef bzero#define bzero(buf, len) _dmalloc_bzero(buf, len)#undef memccpy#define memccpy(s1, s2, ch, len) _dmalloc_memccpy(s1, s2, ch, len)#undef memchr#define memchr(s1, ch, len) _dmalloc_memchr(s1, ch, len)#undef strchr#define strchr(str, ch) _dmalloc_strchr(str, ch)#undef strrchr#define strrchr(str, ch) _dmalloc_strrchr(str, ch)#undef strcpy#define strcpy(to, from) _dmalloc_strcpy(to, from)#undef strncpy#define strncpy(to, from, len) _dmalloc_strncpy(to, from, len)#undef strcasecmp#define strcasecmp(s1, s2) _dmalloc_strcasecmp(s1, s2)#undef strncasecmp#define strncasecmp(s1, s2, len) _dmalloc_strncasecmp(s1, s2, len)#undef strspn#define strspn(str, list) _dmalloc_strspn(str, list)#undef strcspn#define strcspn(str, list) _dmalloc_strcspn(str, list)#undef strncat#define strncat(to, from, len) _dmalloc_strncat(to, from, len)#undef strncmp#define strncmp(s1, s2, len) _dmalloc_strncmp(s1, s2, len)#undef strpbrk#define strpbrk(str, list) _dmalloc_strpbrk(str, list)#undef strstr#define strstr(str, pat) _dmalloc_strstr(str, pat)#endif /* DMALLOC_FUNC_CHECK */#endif /* ! DMALLOC_DISABLE *//* we start FUNC_CHECK again because we had to stop it above */#ifdef DMALLOC_FUNC_CHECK/* * feel free to add your favorite functions here and to arg_check.[ch] */#ifdef __cplusplusextern "C" {#endif/* * copied in from arg_check.h with all comments removed */externint _dmalloc_bcmp(const void *b1, const void *b2, const DMALLOC_SIZE len);externvoid _dmalloc_bcopy(const void *from, void *to, const DMALLOC_SIZE len);externint _dmalloc_memcmp(const void *b1, const void *b2, const DMALLOC_SIZE len);externvoid *_dmalloc_memcpy(void *to, const void *from, const DMALLOC_SIZE len);externvoid *_dmalloc_memset(void *buf, const int ch, const DMALLOC_SIZE len);externchar *_dmalloc_index(const char *str, const char ch);externchar *_dmalloc_rindex(const char *str, const char ch);externchar *_dmalloc_strcat(char *to, const char *from);externint _dmalloc_strcmp(const char *s1, const char *s2);externDMALLOC_SIZE _dmalloc_strlen(const char *str);externchar *_dmalloc_strtok(char *str, const char *sep);externvoid _dmalloc_bzero(void *buf, const DMALLOC_SIZE len);externvoid *_dmalloc_memccpy(void *s1, const void *s2, const int ch, const DMALLOC_SIZE len);externvoid *_dmalloc_memchr(const void *s1, const int ch, const DMALLOC_SIZE len);externchar *_dmalloc_strchr(const char *str, const int ch);externchar *_dmalloc_strrchr(const char *str, const int ch);externchar *_dmalloc_strcpy(char *to, const char *from);externchar *_dmalloc_strncpy(char *to, const char *from, const DMALLOC_SIZE len);externint _dmalloc_strcasecmp(const char *s1, const char *s2);externint _dmalloc_strncasecmp(const char *s1, const char *s2, const DMALLOC_SIZE len);externint _dmalloc_strspn(const char *str, const char *list);externint _dmalloc_strcspn(const char *str, const char *list);externchar *_dmalloc_strncat(char *to, const char *from, const DMALLOC_SIZE len);externint _dmalloc_strncmp(const char *s1, const char *s2, const DMALLOC_SIZE len);externchar *_dmalloc_strpbrk(const char *str, const char *list);externchar *_dmalloc_strstr(const char *str, const char *pat);#ifdef __cplusplus}#endif#endif /* DMALLOC_FUNC_CHECK */#ifdef __cplusplusextern "C" {#endif/* * Copied directly from dmalloc_lp.h, removed some routines *//* internal dmalloc error number for reference purposes only */externint dmalloc_errno;/* * leap routine to malloc */externDMALLOC_PNT _malloc_leap(const char *file, const int line, DMALLOC_SIZE size);/* * leap routine to calloc */externDMALLOC_PNT _calloc_leap(const char *file, const int line, DMALLOC_SIZE ele_n, DMALLOC_SIZE size);/* * leap routine to realloc */externDMALLOC_PNT _realloc_leap(const char *file, const int line, DMALLOC_PNT old_p, DMALLOC_SIZE new_size);/* * leap routine to recalloc */externDMALLOC_PNT _recalloc_leap(const char *file, const int line, DMALLOC_PNT old_p, DMALLOC_SIZE new_size);/* * leap routine to memalign */externDMALLOC_PNT _memalign_leap(const char *file, const int line, DMALLOC_SIZE alignment, DMALLOC_SIZE size);/* * leap routine to valloc */externDMALLOC_PNT _valloc_leap(const char *file, const int line, DMALLOC_SIZE size);/* * leap routine to strdup */externchar *_strdup_leap(const char *file, const int line, const char *str);/* * leap routine to free */externDMALLOC_FREE_RET _free_leap(const char *file, const int line, DMALLOC_PNT pnt);/* * leap routine to malloc with error checking */externDMALLOC_PNT _xmalloc_leap(const char *file, const int line, DMALLOC_SIZE size);/* * leap routine to calloc with error checking */externDMALLOC_PNT _xcalloc_leap(const char *file, const int line, DMALLOC_SIZE ele_n, DMALLOC_SIZE size);/* * leap routine to realloc with error checking */externDMALLOC_PNT _xrealloc_leap(const char *file, const int line, DMALLOC_PNT old_p, DMALLOC_SIZE new_size);/* * leap routine to recalloc with error checking */externDMALLOC_PNT _xrecalloc_leap(const char *file, const int line, DMALLOC_PNT old_p, DMALLOC_SIZE new_size);/* * leap routine to memalign with error checking */externDMALLOC_PNT _xmemalign_leap(const char *file, const int line, DMALLOC_SIZE alignment, DMALLOC_SIZE size);/* * leap routine to valloc with error checking */externDMALLOC_PNT _xvalloc_leap(const char *file, const int line, DMALLOC_SIZE size);/* * leap routine for strdup with error checking */externchar *_xstrdup_leap(const char *file, const int line, const char *str);/* * leap routine to free */externDMALLOC_FREE_RET _xfree_leap(const char *file, const int line, DMALLOC_PNT pnt);#ifdef __cplusplus}#endif#endif /* ! __DMALLOC_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -