the malloc debug system only logs data if the logfile FILE * is set, which

makes it easier to disable debug output when built with debug functions
This commit is contained in:
Daniel Stenberg
2001-10-17 12:33:35 +00:00
parent db0e3cc60c
commit 010044e03c
2 changed files with 44 additions and 27 deletions

View File

@@ -96,21 +96,27 @@ int curl_getaddrinfo(char *hostname, char *service,
int line, const char *source)
{
int res=(getaddrinfo)(hostname, service, hints, result);
if(0 == res)
if(0 == res) {
/* success */
fprintf(logfile?logfile:stderr, "ADDR %s:%d getaddrinfo() = %p\n",
source, line, *result);
else
fprintf(logfile?logfile:stderr, "ADDR %s:%d getaddrinfo() failed\n",
source, line);
if(logfile)
fprintf(logfile, "ADDR %s:%d getaddrinfo() = %p\n",
source, line, *result);
}
else {
if(logfile)
fprintf(logfile, "ADDR %s:%d getaddrinfo() failed\n",
source, line);
}
return res;
}
void curl_freeaddrinfo(struct addrinfo *freethis,
int line, const char *source)
{
(freeaddrinfo)(freethis);
fprintf(logfile?logfile:stderr, "ADDR %s:%d freeaddrinfo(%p)\n",
source, line, freethis);
if(logfile)
fprintf(logfile, "ADDR %s:%d freeaddrinfo(%p)\n",
source, line, freethis);
}
#endif