mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
const-ified lots of function arguments
This commit is contained in:
parent
b1c57788f3
commit
5afc694879
@ -64,7 +64,7 @@ void curl_memdebug(char *logname)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void *curl_domalloc(size_t size, int line, char *source)
|
void *curl_domalloc(size_t size, int line, const char *source)
|
||||||
{
|
{
|
||||||
void *mem=(malloc)(size);
|
void *mem=(malloc)(size);
|
||||||
fprintf(logfile?logfile:stderr, "MEM %s:%d malloc(%d) = %p\n",
|
fprintf(logfile?logfile:stderr, "MEM %s:%d malloc(%d) = %p\n",
|
||||||
@ -72,7 +72,7 @@ void *curl_domalloc(size_t size, int line, char *source)
|
|||||||
return mem;
|
return mem;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *curl_dostrdup(const char *str, int line, char *source)
|
char *curl_dostrdup(const char *str, int line, const char *source)
|
||||||
{
|
{
|
||||||
char *mem;
|
char *mem;
|
||||||
size_t len;
|
size_t len;
|
||||||
@ -90,7 +90,7 @@ char *curl_dostrdup(const char *str, int line, char *source)
|
|||||||
return mem;
|
return mem;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *curl_dorealloc(void *ptr, size_t size, int line, char *source)
|
void *curl_dorealloc(void *ptr, size_t size, int line, const char *source)
|
||||||
{
|
{
|
||||||
void *mem=(realloc)(ptr, size);
|
void *mem=(realloc)(ptr, size);
|
||||||
fprintf(logfile?logfile:stderr, "MEM %s:%d realloc(%p, %d) = %p\n",
|
fprintf(logfile?logfile:stderr, "MEM %s:%d realloc(%p, %d) = %p\n",
|
||||||
@ -98,7 +98,7 @@ void *curl_dorealloc(void *ptr, size_t size, int line, char *source)
|
|||||||
return mem;
|
return mem;
|
||||||
}
|
}
|
||||||
|
|
||||||
void curl_dofree(void *ptr, int line, char *source)
|
void curl_dofree(void *ptr, int line, const char *source)
|
||||||
{
|
{
|
||||||
if(NULL == ptr) {
|
if(NULL == ptr) {
|
||||||
fprintf(stderr, "ILLEGAL free() on NULL at %s:%d\n",
|
fprintf(stderr, "ILLEGAL free() on NULL at %s:%d\n",
|
||||||
@ -121,7 +121,7 @@ int curl_socket(int domain, int type, int protocol, int line, char *source)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int curl_accept(int s, struct sockaddr *addr, socklen_t *addrlen,
|
int curl_accept(int s, struct sockaddr *addr, socklen_t *addrlen,
|
||||||
int line, char *source)
|
int line, const char *source)
|
||||||
{
|
{
|
||||||
int sockfd=(accept)(s, addr, addrlen);
|
int sockfd=(accept)(s, addr, addrlen);
|
||||||
fprintf(logfile?logfile:stderr, "FD %s:%d accept() = %d\n",
|
fprintf(logfile?logfile:stderr, "FD %s:%d accept() = %d\n",
|
||||||
@ -138,7 +138,8 @@ int curl_sclose(int sockfd, int line, char *source)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE *curl_fopen(char *file, char *mode, int line, char *source)
|
FILE *curl_fopen(const char *file, const char *mode,
|
||||||
|
int line, const char *source)
|
||||||
{
|
{
|
||||||
FILE *res=(fopen)(file, mode);
|
FILE *res=(fopen)(file, mode);
|
||||||
fprintf(logfile?logfile:stderr, "FILE %s:%d fopen(\"%s\") = %p\n",
|
fprintf(logfile?logfile:stderr, "FILE %s:%d fopen(\"%s\") = %p\n",
|
||||||
@ -146,7 +147,7 @@ FILE *curl_fopen(char *file, char *mode, int line, char *source)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
int curl_fclose(FILE *file, int line, char *source)
|
int curl_fclose(FILE *file, int line, const char *source)
|
||||||
{
|
{
|
||||||
int res=(fclose)(file);
|
int res=(fclose)(file);
|
||||||
fprintf(logfile?logfile:stderr, "FILE %s:%d fclose(%p)\n",
|
fprintf(logfile?logfile:stderr, "FILE %s:%d fclose(%p)\n",
|
||||||
|
@ -7,21 +7,22 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* memory functions */
|
/* memory functions */
|
||||||
void *curl_domalloc(size_t size, int line, char *source);
|
void *curl_domalloc(size_t size, int line, const char *source);
|
||||||
void *curl_dorealloc(void *ptr, size_t size, int line, char *source);
|
void *curl_dorealloc(void *ptr, size_t size, int line, const char *source);
|
||||||
void curl_dofree(void *ptr, int line, char *source);
|
void curl_dofree(void *ptr, int line, const char *source);
|
||||||
char *curl_dostrdup(const char *str, int line, char *source);
|
char *curl_dostrdup(const char *str, int line, const char *source);
|
||||||
void curl_memdebug(char *logname);
|
void curl_memdebug(char *logname);
|
||||||
|
|
||||||
/* file descriptor manipulators */
|
/* file descriptor manipulators */
|
||||||
int curl_socket(int domain, int type, int protocol, int, char *);
|
int curl_socket(int domain, int type, int protocol, int, const char *);
|
||||||
int curl_sclose(int sockfd, int, char *);
|
int curl_sclose(int sockfd, int, const char *source);
|
||||||
int curl_accept(int s, struct sockaddr *addr, socklen_t *addrlen,
|
int curl_accept(int s, struct sockaddr *addr, socklen_t *addrlen,
|
||||||
int line, char *source);
|
int line, const char *source);
|
||||||
|
|
||||||
/* FILE functions */
|
/* FILE functions */
|
||||||
FILE *curl_fopen(char *file, char *mode, int line, char *source);
|
FILE *curl_fopen(const char *file, const char *mode, int line,
|
||||||
int curl_fclose(FILE *file, int line, char *source);
|
const char *source);
|
||||||
|
int curl_fclose(FILE *file, int line, const char *source);
|
||||||
|
|
||||||
/* Set this symbol on the command-line, recompile all lib-sources */
|
/* Set this symbol on the command-line, recompile all lib-sources */
|
||||||
#define strdup(ptr) curl_dostrdup(ptr, __LINE__, __FILE__)
|
#define strdup(ptr) curl_dostrdup(ptr, __LINE__, __FILE__)
|
||||||
|
Loading…
Reference in New Issue
Block a user