⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 arg_check.c

📁 测试内存泄露工具
💻 C
📖 第 1 页 / 共 2 页
字号:
      dmalloc_message("bad pointer argument found in strcasecmp");    }  }  return strcasecmp(s1, s2);}#endif /* HAVE_STRCASECMP */#if HAVE_STRCAT/* * Dummy function for checking strcat's arguments. */char	*_dmalloc_strcat(char *to, const char *from){  if (BIT_IS_SET(_dmalloc_flags, DEBUG_CHECK_FUNCS)) {    if ((! dmalloc_verify_pnt(__FILE__, __LINE__, "strcat", to,			      0 /* not exact */,			      strlen(to) + strlen(from) + 1))	|| (! dmalloc_verify_pnt(__FILE__, __LINE__, "strcat", from,				 0 /* not exact */, -1))) {      dmalloc_message("bad pointer argument found in strcat");    }  }  return (char *)strcat(to, from);}#endif /* HAVE_STRCAT */#if HAVE_STRCHR/* * Dummy function for checking strchr's arguments. */char	*_dmalloc_strchr(const char *str, const int ch){  if (BIT_IS_SET(_dmalloc_flags, DEBUG_CHECK_FUNCS)) {    if (! dmalloc_verify_pnt(__FILE__, __LINE__, "strchr", str,			     0 /* not exact */, -1)) {      dmalloc_message("bad pointer argument found in strchr");    }  }  return (char *)strchr(str, ch);}#endif /* HAVE_STRCHR */#if HAVE_STRCMP/* * Dummy function for checking strcmp's arguments. */int	_dmalloc_strcmp(const char *s1, const char *s2){  if (BIT_IS_SET(_dmalloc_flags, DEBUG_CHECK_FUNCS)) {    if ((! dmalloc_verify_pnt(__FILE__, __LINE__, "strcmp", s1,			      0 /* not exact */, -1))	|| (! dmalloc_verify_pnt(__FILE__, __LINE__, "strcmp", s2,				 0 /* not exact */, -1))) {      dmalloc_message("bad pointer argument found in strcmp");    }  }  return strcmp(s1, s2);}#endif /* HAVE_STRCMP */#if HAVE_STRCPY/* * Dummy function for checking strcpy's arguments. */char	*_dmalloc_strcpy(char *to, const char *from){  if (BIT_IS_SET(_dmalloc_flags, DEBUG_CHECK_FUNCS)) {    if ((! dmalloc_verify_pnt(__FILE__, __LINE__, "strcpy", to,			      0 /* not exact */, strlen(from) + 1))	|| (! dmalloc_verify_pnt(__FILE__, __LINE__, "strcpy", from,				 0 /* not exact */, -1))) {      dmalloc_message("bad pointer argument found in strcpy");    }  }  return (char *)strcpy(to, from);}#endif /* HAVE_STRCPY */#if HAVE_STRCSPN/* * Dummy function for checking strcspn's arguments. */int	_dmalloc_strcspn(const char *str, const char *list){  if (BIT_IS_SET(_dmalloc_flags, DEBUG_CHECK_FUNCS)) {    if ((! dmalloc_verify_pnt(__FILE__, __LINE__, "strcspn", str,			      0 /* not exact */, -1))	|| (! dmalloc_verify_pnt(__FILE__, __LINE__, "strcspn", list,				 0 /* not exact */, -1))) {      dmalloc_message("bad pointer argument found in strcspn");    }  }  return strcspn(str, list);}#endif /* HAVE_STRCSPN */#if HAVE_STRLEN/* * Dummy function for checking strlen's arguments. */DMALLOC_SIZE	_dmalloc_strlen(const char *str){  if (BIT_IS_SET(_dmalloc_flags, DEBUG_CHECK_FUNCS)) {    if (! dmalloc_verify_pnt(__FILE__, __LINE__, "strlen", str,			     0 /* not exact */, -1)) {      dmalloc_message("bad pointer argument found in strlen");    }  }  return strlen(str);}#endif /* HAVE_STRLEN */#if HAVE_STRNCASECMP/* * Dummy function for checking strncasecmp's arguments. */int	_dmalloc_strncasecmp(const char *s1, const char *s2,			     const DMALLOC_SIZE len){  if (BIT_IS_SET(_dmalloc_flags, DEBUG_CHECK_FUNCS)) {    /* len or until nullc */    if ((! dmalloc_verify_pnt(__FILE__, __LINE__, "strncasecmp", s1,			      0 /* not exact */, -1))	|| (! dmalloc_verify_pnt(__FILE__, __LINE__, "strncasecmp", s2,				 0 /* not exact */, -1))) {      dmalloc_message("bad pointer argument found in strncasecmp");    }  }  return strncasecmp(s1, s2, len);}#endif /* HAVE_STRNCASECMP */#if HAVE_STRNCAT/* * Dummy function for checking strncat's arguments. */char	*_dmalloc_strncat(char *to, const char *from, const DMALLOC_SIZE len){  if (BIT_IS_SET(_dmalloc_flags, DEBUG_CHECK_FUNCS)) {    /* either len or nullc */    if ((! dmalloc_verify_pnt(__FILE__, __LINE__, "strncat", to,			      0 /* not exact */, -1))	|| (! dmalloc_verify_pnt(__FILE__, __LINE__, "strncat", from,				 0 /* not exact */, -1))) {      dmalloc_message("bad pointer argument found in strncat");    }  }  return (char *)strncat(to, from, len);}#endif /* HAVE_STRNCAT */#if HAVE_STRNCMP/* * Dummy function for checking strncmp's arguments. */int	_dmalloc_strncmp(const char *s1, const char *s2,			 const DMALLOC_SIZE len){  if (BIT_IS_SET(_dmalloc_flags, DEBUG_CHECK_FUNCS)) {    /* either len or nullc */    if ((! dmalloc_verify_pnt(__FILE__, __LINE__, "strncmp", s1,			      0 /* not exact */, -1))	|| (! dmalloc_verify_pnt(__FILE__, __LINE__, "strncmp", s2,				 0 /* not exact */, -1))) {      dmalloc_message("bad pointer argument found in strncmp");    }  }  return strncmp(s1, s2, len);}#endif /* HAVE_STRNCMP */#if HAVE_STRNCPY/* * Dummy function for checking strncpy's arguments. */char	*_dmalloc_strncpy(char *to, const char *from, const DMALLOC_SIZE len){  if (BIT_IS_SET(_dmalloc_flags, DEBUG_CHECK_FUNCS)) {    /* len or until nullc */    if ((! dmalloc_verify_pnt(__FILE__, __LINE__, "strncpy", to,			      0 /* not exact */, 0))	|| (! dmalloc_verify_pnt(__FILE__, __LINE__, "strncpy", from,				 0 /* not exact */, -1))) {      dmalloc_message("bad pointer argument found in strncpy");    }  }  return (char *)strncpy(to, from, len);}#endif /* HAVE_STRNCPY */#if HAVE_STRPBRK/* * Dummy function for checking strpbrk's arguments. */char	*_dmalloc_strpbrk(const char *str, const char *list){  if (BIT_IS_SET(_dmalloc_flags, DEBUG_CHECK_FUNCS)) {    if ((! dmalloc_verify_pnt(__FILE__, __LINE__, "strpbrk", str,			      0 /* not exact */, -1))	|| (! dmalloc_verify_pnt(__FILE__, __LINE__, "strpbrk", list,				 0 /* not exact */, -1))) {      dmalloc_message("bad pointer argument found in strpbrk");    }  }  return (char *)strpbrk(str, list);}#endif /* HAVE_STRPBRK */#if HAVE_STRRCHR/* * Dummy function for checking strrchr's arguments. */char	*_dmalloc_strrchr(const char *str, const int ch){  if (BIT_IS_SET(_dmalloc_flags, DEBUG_CHECK_FUNCS)) {    if (! dmalloc_verify_pnt(__FILE__, __LINE__, "strrchr", str,			     0 /* not exact */, -1)) {      dmalloc_message("bad pointer argument found in strrchr");    }  }  return (char *)strrchr(str, ch);}#endif /* HAVE_STRRCHR */#if HAVE_STRSPN/* * Dummy function for checking strspn's arguments. */int	_dmalloc_strspn(const char *str, const char *list){  if (BIT_IS_SET(_dmalloc_flags, DEBUG_CHECK_FUNCS)) {    if ((! dmalloc_verify_pnt(__FILE__, __LINE__, "strspn", str,			      0 /* not exact */, -1))	|| (! dmalloc_verify_pnt(__FILE__, __LINE__, "strspn", list,				 0 /* not exact */, -1))) {      dmalloc_message("bad pointer argument found in strspn");    }  }  return strspn(str, list);}#endif /* HAVE_STRSPN */#if HAVE_STRSTR/* * Dummy function for checking strstr's arguments. */char	*_dmalloc_strstr(const char *str, const char *pat){  if (BIT_IS_SET(_dmalloc_flags, DEBUG_CHECK_FUNCS)) {    if ((! dmalloc_verify_pnt(__FILE__, __LINE__, "strstr", str,			      0 /* not exact */, -1))	|| (! dmalloc_verify_pnt(__FILE__, __LINE__, "strstr", pat,				 0 /* not exact */, -1))) {      dmalloc_message("bad pointer argument found in strstr");    }  }  return (char *)strstr(str, pat);}#endif /* HAVE_STRSTR */#if HAVE_STRTOK/* * Dummy function for checking strtok's arguments. */char	*_dmalloc_strtok(char *str, const char *sep){  if (BIT_IS_SET(_dmalloc_flags, DEBUG_CHECK_FUNCS)) {    if ((str != NULL	 && (! dmalloc_verify_pnt(__FILE__, __LINE__, "strtok", str,				  0 /* not exact */, -1)))	|| (! dmalloc_verify_pnt(__FILE__, __LINE__, "strtok", sep,				 0 /* not exact */, -1))) {      dmalloc_message("bad pointer argument found in strtok");    }  }  return (char *)strtok(str, sep);}#endif /* HAVE_STRTOK */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -