2 /***************************************************************************
4 * Project ___| | | | _ \| |
6 * | (__| |_| | _ <| |___
7 * \___|\___/|_| \_\_____|
9 * Copyright (C) 1998 - 2002, 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>
31 #ifdef HAVE_SYS_SOCKET_H
32 #include <sys/socket.h>
41 /* memory functions */
42 void *curl_domalloc(size_t size, int line, const char *source);
43 void *curl_dorealloc(void *ptr, size_t size, int line, const char *source);
44 void curl_dofree(void *ptr, int line, const char *source);
45 char *curl_dostrdup(const char *str, int line, const char *source);
46 void curl_memdebug(const char *logname);
48 /* file descriptor manipulators */
49 int curl_socket(int domain, int type, int protocol, int, const char *);
50 int curl_sclose(int sockfd, int, const char *source);
51 int curl_accept(int s, struct sockaddr *addr, socklen_t *addrlen,
52 int line, const char *source);
55 FILE *curl_fopen(const char *file, const char *mode, int line,
57 int curl_fclose(FILE *file, int line, const char *source);
59 /* Set this symbol on the command-line, recompile all lib-sources */
60 #define strdup(ptr) curl_dostrdup(ptr, __LINE__, __FILE__)
61 #define malloc(size) curl_domalloc(size, __LINE__, __FILE__)
62 #define realloc(ptr,size) curl_dorealloc(ptr, size, __LINE__, __FILE__)
63 #define free(ptr) curl_dofree(ptr, __LINE__, __FILE__)
65 #define socket(domain,type,protocol)\
66 curl_socket(domain,type,protocol,__LINE__,__FILE__)
67 #define accept(sock,addr,len)\
68 curl_accept(sock,addr,len,__LINE__,__FILE__)
70 #define getaddrinfo(host,serv,hint,res) \
71 curl_getaddrinfo(host,serv,hint,res,__LINE__,__FILE__)
72 #define freeaddrinfo(data) \
73 curl_freeaddrinfo(data,__LINE__,__FILE__)
75 /* sclose is probably already defined, redefine it! */
77 #define sclose(sockfd) curl_sclose(sockfd,__LINE__,__FILE__)
80 #define fopen(file,mode) curl_fopen(file,mode,__LINE__,__FILE__)
81 #define fclose(file) curl_fclose(file,__LINE__,__FILE__)