2 /***************************************************************************
4 * Project ___| | | | _ \| |
6 * | (__| |_| | _ <| |___
7 * \___|\___/|_| \_\_____|
9 * Copyright (C) 1998 - 2003, Daniel Stenberg, <daniel@haxx.se>, et al.
11 * This software is licensed as described in the file COPYING, which
12 * you should have received as part of this distribution. The terms
13 * are also available at http://curl.haxx.se/docs/copyright.html.
15 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
16 * copies of the Software, and permit persons to whom the Software is
17 * furnished to do so, under the terms of the COPYING file.
19 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 * KIND, either express or implied.
23 ***************************************************************************/
27 #ifdef HAVE_SYS_TYPES_H
28 #include <sys/types.h>
34 #ifdef HAVE_SYS_SOCKET_H
35 #include <sys/socket.h>
44 /* memory functions */
45 void *curl_domalloc(size_t size, int line, const char *source);
46 void *curl_dorealloc(void *ptr, size_t size, int line, const char *source);
47 void curl_dofree(void *ptr, int line, const char *source);
48 char *curl_dostrdup(const char *str, int line, const char *source);
49 void curl_memdebug(const char *logname);
51 /* file descriptor manipulators */
52 int curl_socket(int domain, int type, int protocol, int, const char *);
53 int curl_sclose(int sockfd, int, const char *source);
54 int curl_accept(int s, struct sockaddr *addr, socklen_t *addrlen,
55 int line, const char *source);
58 FILE *curl_fopen(const char *file, const char *mode, int line,
60 int curl_fclose(FILE *file, int line, const char *source);
62 /* Set this symbol on the command-line, recompile all lib-sources */
64 #define strdup(ptr) curl_dostrdup(ptr, __LINE__, __FILE__)
65 #define malloc(size) curl_domalloc(size, __LINE__, __FILE__)
66 #define realloc(ptr,size) curl_dorealloc(ptr, size, __LINE__, __FILE__)
67 #define free(ptr) curl_dofree(ptr, __LINE__, __FILE__)
69 #define socket(domain,type,protocol)\
70 curl_socket(domain,type,protocol,__LINE__,__FILE__)
71 #define accept(sock,addr,len)\
72 curl_accept(sock,addr,len,__LINE__,__FILE__)
74 #define getaddrinfo(host,serv,hint,res) \
75 curl_getaddrinfo(host,serv,hint,res,__LINE__,__FILE__)
76 #define freeaddrinfo(data) \
77 curl_freeaddrinfo(data,__LINE__,__FILE__)
79 /* sclose is probably already defined, redefine it! */
81 #define sclose(sockfd) curl_sclose(sockfd,__LINE__,__FILE__)
84 #define fopen(file,mode) curl_fopen(file,mode,__LINE__,__FILE__)
85 #define fclose(file) curl_fclose(file,__LINE__,__FILE__)