Added appropriate casts from (void*) so that the code will compile
cleanly with a C++ compiler. (Tested using GCC 3.3)
This commit is contained in:
parent
ab02f47a29
commit
6aaa863432
@ -1,4 +1,4 @@
|
|||||||
/* $Id: acl.c,v 1.16 2002-06-05 16:59:21 rjkaes Exp $
|
/* $Id: acl.c,v 1.17 2003-07-31 23:38:28 rjkaes Exp $
|
||||||
*
|
*
|
||||||
* This system handles Access Control for use of this daemon. A list of
|
* This system handles Access Control for use of this daemon. A list of
|
||||||
* domains, or IP addresses (including IP blocks) are stored in a list
|
* domains, or IP addresses (including IP blocks) are stored in a list
|
||||||
@ -24,9 +24,11 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "sock.h"
|
#include "sock.h"
|
||||||
|
|
||||||
|
enum acl_type { ACL_STRING, ACL_NUMERIC };
|
||||||
|
|
||||||
struct acl_s {
|
struct acl_s {
|
||||||
acl_access_t acl_access;
|
acl_access_t acl_access;
|
||||||
enum { ACL_STRING, ACL_NUMERIC } type;
|
enum acl_type type;
|
||||||
char *location;
|
char *location;
|
||||||
int netmask;
|
int netmask;
|
||||||
struct acl_s *next;
|
struct acl_s *next;
|
||||||
@ -85,7 +87,7 @@ insert_acl(char *location, acl_access_t access_type)
|
|||||||
rev_acl_ptr = &acl_ptr->next;
|
rev_acl_ptr = &acl_ptr->next;
|
||||||
acl_ptr = acl_ptr->next;
|
acl_ptr = acl_ptr->next;
|
||||||
}
|
}
|
||||||
new_acl_ptr = safemalloc(sizeof(struct acl_s));
|
new_acl_ptr = (struct acl_s*)safemalloc(sizeof(struct acl_s));
|
||||||
if (!new_acl_ptr) {
|
if (!new_acl_ptr) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: buffer.c,v 1.22 2002-05-24 04:45:32 rjkaes Exp $
|
/* $Id: buffer.c,v 1.23 2003-07-31 23:38:28 rjkaes Exp $
|
||||||
*
|
*
|
||||||
* The buffer used in each connection is a linked list of lines. As the lines
|
* The buffer used in each connection is a linked list of lines. As the lines
|
||||||
* are read in and written out the buffer expands and contracts. Basically,
|
* are read in and written out the buffer expands and contracts. Basically,
|
||||||
@ -60,10 +60,10 @@ makenewline(unsigned char *data, size_t length)
|
|||||||
assert(data != NULL);
|
assert(data != NULL);
|
||||||
assert(length > 0);
|
assert(length > 0);
|
||||||
|
|
||||||
if (!(newline = safemalloc(sizeof(struct bufline_s))))
|
if (!(newline = (struct bufline_s*)safemalloc(sizeof(struct bufline_s))))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!(newline->string = safemalloc(length))) {
|
if (!(newline->string = (unsigned char*)safemalloc(length))) {
|
||||||
safefree(newline);
|
safefree(newline);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -104,7 +104,7 @@ new_buffer(void)
|
|||||||
{
|
{
|
||||||
struct buffer_s *buffptr;
|
struct buffer_s *buffptr;
|
||||||
|
|
||||||
if (!(buffptr = safemalloc(sizeof(struct buffer_s))))
|
if (!(buffptr = (struct buffer_s*)safemalloc(sizeof(struct buffer_s))))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: conns.c,v 1.17 2003-05-31 23:02:21 rjkaes Exp $
|
/* $Id: conns.c,v 1.18 2003-07-31 23:38:28 rjkaes Exp $
|
||||||
*
|
*
|
||||||
* Create and free the connection structure. One day there could be
|
* Create and free the connection structure. One day there could be
|
||||||
* other connection related tasks put here, but for now the header
|
* other connection related tasks put here, but for now the header
|
||||||
@ -46,7 +46,7 @@ initialize_conn(int client_fd, const char* ipaddr, const char* string_addr)
|
|||||||
/*
|
/*
|
||||||
* Allocate the space for the conn_s structure itself.
|
* Allocate the space for the conn_s structure itself.
|
||||||
*/
|
*/
|
||||||
connptr = safemalloc(sizeof(struct conn_s));
|
connptr = (struct conn_s*)safemalloc(sizeof(struct conn_s));
|
||||||
if (!connptr)
|
if (!connptr)
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
|
|
||||||
|
18
src/filter.c
18
src/filter.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: filter.c,v 1.16 2003-01-27 17:57:39 rjkaes Exp $
|
/* $Id: filter.c,v 1.17 2003-07-31 23:38:28 rjkaes Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1999 George Talusan (gstalusan@uwaterloo.ca)
|
* Copyright (c) 1999 George Talusan (gstalusan@uwaterloo.ca)
|
||||||
* Copyright (c) 2002 James E. Flemer (jflemer@acm.jhu.edu)
|
* Copyright (c) 2002 James E. Flemer (jflemer@acm.jhu.edu)
|
||||||
@ -67,14 +67,16 @@ filter_init(void)
|
|||||||
s = buf;
|
s = buf;
|
||||||
if (!p) /* head of list */
|
if (!p) /* head of list */
|
||||||
fl = p =
|
fl = p =
|
||||||
safecalloc(1,
|
(struct filter_list*)
|
||||||
sizeof(struct
|
safecalloc(1,
|
||||||
filter_list));
|
sizeof(struct
|
||||||
|
filter_list));
|
||||||
else { /* next entry */
|
else { /* next entry */
|
||||||
p->next =
|
p->next =
|
||||||
safecalloc(1,
|
(struct filter_list*)
|
||||||
sizeof(struct
|
safecalloc(1,
|
||||||
filter_list));
|
sizeof(struct
|
||||||
|
filter_list));
|
||||||
p = p->next;
|
p = p->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +98,7 @@ filter_init(void)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
p->pat = safestrdup(s);
|
p->pat = safestrdup(s);
|
||||||
p->cpat = safemalloc(sizeof(regex_t));
|
p->cpat = (regex_t*)safemalloc(sizeof(regex_t));
|
||||||
if ((err = regcomp(p->cpat, p->pat, cflags)) != 0) {
|
if ((err = regcomp(p->cpat, p->pat, cflags)) != 0) {
|
||||||
fprintf(stderr, "Bad regex in %s: %s\n",
|
fprintf(stderr, "Bad regex in %s: %s\n",
|
||||||
config.filter, p->pat);
|
config.filter, p->pat);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: hashmap.c,v 1.12 2003-05-31 23:02:21 rjkaes Exp $
|
/* $Id: hashmap.c,v 1.13 2003-07-31 23:38:28 rjkaes Exp $
|
||||||
*
|
*
|
||||||
* A hashmap implementation. The keys are case-insensitive NULL terminated
|
* A hashmap implementation. The keys are case-insensitive NULL terminated
|
||||||
* strings, and the data is arbitrary lumps of data. Copies of both the
|
* strings, and the data is arbitrary lumps of data. Copies of both the
|
||||||
@ -97,12 +97,14 @@ hashmap_create(unsigned int nbuckets)
|
|||||||
if (nbuckets == 0)
|
if (nbuckets == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ptr = safecalloc(1, sizeof(struct hashmap_s));
|
ptr = (struct hashmap_s*)safecalloc(1, sizeof(struct hashmap_s));
|
||||||
if (!ptr)
|
if (!ptr)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ptr->size = nbuckets;
|
ptr->size = nbuckets;
|
||||||
ptr->buckets = safecalloc(nbuckets, sizeof(struct hashentry_s *));
|
ptr->buckets =
|
||||||
|
(struct hashentry_s**)safecalloc(nbuckets,
|
||||||
|
sizeof(struct hashentry_s *));
|
||||||
if (!ptr->buckets) {
|
if (!ptr->buckets) {
|
||||||
safefree(ptr);
|
safefree(ptr);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -223,7 +225,7 @@ hashmap_insert(hashmap_t map, const char *key,
|
|||||||
data_copy = NULL;
|
data_copy = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr = safemalloc(sizeof(struct hashentry_s));
|
ptr = (struct hashentry_s*)safemalloc(sizeof(struct hashentry_s));
|
||||||
if (!ptr) {
|
if (!ptr) {
|
||||||
safefree(key_copy);
|
safefree(key_copy);
|
||||||
safefree(data_copy);
|
safefree(data_copy);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: http_message.c,v 1.2 2003-05-31 23:02:21 rjkaes Exp $
|
/* $Id: http_message.c,v 1.3 2003-07-31 23:38:28 rjkaes Exp $
|
||||||
*
|
*
|
||||||
* See 'http_message.h' for a detailed description.
|
* See 'http_message.h' for a detailed description.
|
||||||
*
|
*
|
||||||
@ -81,11 +81,11 @@ http_message_create(int response_code, const char* response_string)
|
|||||||
http_message_t msg;
|
http_message_t msg;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
msg = safecalloc(1, sizeof(struct http_message_s));
|
msg = (http_message_t)safecalloc(1, sizeof(struct http_message_s));
|
||||||
if (msg == NULL)
|
if (msg == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
msg->headers.strings = safecalloc(NUMBER_OF_HEADERS, sizeof(char*));
|
msg->headers.strings = (char**)safecalloc(NUMBER_OF_HEADERS, sizeof(char*));
|
||||||
if (msg->headers.strings == NULL) {
|
if (msg->headers.strings == NULL) {
|
||||||
safefree(msg);
|
safefree(msg);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -182,8 +182,8 @@ http_message_add_headers(http_message_t msg, char** headers,
|
|||||||
* available, reallocate the memory.
|
* available, reallocate the memory.
|
||||||
*/
|
*/
|
||||||
if (msg->headers.used + num_headers > msg->headers.total) {
|
if (msg->headers.used + num_headers > msg->headers.total) {
|
||||||
new_headers = safecalloc(msg->headers.total * 2,
|
new_headers = (char**)safecalloc(msg->headers.total * 2,
|
||||||
sizeof(char*));
|
sizeof(char*));
|
||||||
if (new_headers == NULL)
|
if (new_headers == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
@ -215,7 +215,7 @@ http_message_send(http_message_t msg, int fd)
|
|||||||
{
|
{
|
||||||
char timebuf[30];
|
char timebuf[30];
|
||||||
time_t global_time;
|
time_t global_time;
|
||||||
int i;
|
unsigned int i;
|
||||||
|
|
||||||
assert(is_http_message_valid(msg));
|
assert(is_http_message_valid(msg));
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: log.c,v 1.26 2003-05-31 23:02:21 rjkaes Exp $
|
/* $Id: log.c,v 1.27 2003-07-31 23:38:28 rjkaes Exp $
|
||||||
*
|
*
|
||||||
* Logs the various messages which tinyproxy produces to either a log file or
|
* Logs the various messages which tinyproxy produces to either a log file or
|
||||||
* the syslog daemon. Not much to it...
|
* the syslog daemon. Not much to it...
|
||||||
@ -143,7 +143,7 @@ log_message(int level, char *fmt, ...)
|
|||||||
|
|
||||||
vsnprintf(str, STRING_LENGTH, fmt, args);
|
vsnprintf(str, STRING_LENGTH, fmt, args);
|
||||||
|
|
||||||
entry_buffer = safemalloc(strlen(str) + 6);
|
entry_buffer = (char*)safemalloc(strlen(str) + 6);
|
||||||
if (!entry_buffer)
|
if (!entry_buffer)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -202,12 +202,12 @@ send_stored_logs(void)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i != vector_length(log_message_storage); ++i) {
|
for (i = 0; i != vector_length(log_message_storage); ++i) {
|
||||||
string = vector_getentry(log_message_storage, i, NULL);
|
string = (char*)vector_getentry(log_message_storage, i, NULL);
|
||||||
|
|
||||||
ptr = strchr(string, ' ') + 1;
|
ptr = strchr(string, ' ') + 1;
|
||||||
level = atoi(string);
|
level = atoi(string);
|
||||||
|
|
||||||
#if NDEBUG
|
#ifdef NDEBUG
|
||||||
if (log_level == LOG_CONN && level == LOG_INFO)
|
if (log_level == LOG_CONN && level == LOG_INFO)
|
||||||
continue;
|
continue;
|
||||||
else if (log_level == LOG_INFO) {
|
else if (log_level == LOG_INFO) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: network.c,v 1.1 2002-05-23 04:41:48 rjkaes Exp $
|
/* $Id: network.c,v 1.2 2003-07-31 23:38:28 rjkaes Exp $
|
||||||
*
|
*
|
||||||
* The functions found here are used for communicating across a
|
* The functions found here are used for communicating across a
|
||||||
* network. They include both safe reading and writing (which are
|
* network. They include both safe reading and writing (which are
|
||||||
@ -90,7 +90,7 @@ write_message(int fd, const char *fmt, ...)
|
|||||||
char *buf, *tmpbuf;
|
char *buf, *tmpbuf;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
if ((buf = safemalloc(size)) == NULL)
|
if ((buf = (char*)safemalloc(size)) == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
@ -110,7 +110,7 @@ write_message(int fd, const char *fmt, ...)
|
|||||||
/* twice the old size (glibc2.0) */
|
/* twice the old size (glibc2.0) */
|
||||||
size *= 2;
|
size *= 2;
|
||||||
|
|
||||||
if ((tmpbuf = saferealloc(buf, size)) == NULL) {
|
if ((tmpbuf = (char*)saferealloc(buf, size)) == NULL) {
|
||||||
safefree(buf);
|
safefree(buf);
|
||||||
return -1;
|
return -1;
|
||||||
} else
|
} else
|
||||||
@ -154,7 +154,8 @@ readline(int fd, char **whole_buffer)
|
|||||||
};
|
};
|
||||||
struct read_lines_s *first_line, *line_ptr;
|
struct read_lines_s *first_line, *line_ptr;
|
||||||
|
|
||||||
first_line = safecalloc(sizeof(struct read_lines_s), 1);
|
first_line =
|
||||||
|
(struct read_lines_s*)safecalloc(sizeof(struct read_lines_s), 1);
|
||||||
if (!first_line)
|
if (!first_line)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
@ -166,7 +167,7 @@ readline(int fd, char **whole_buffer)
|
|||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
goto CLEANUP;
|
goto CLEANUP;
|
||||||
|
|
||||||
ptr = memchr(buffer, '\n', ret);
|
ptr = (char*)memchr(buffer, '\n', ret);
|
||||||
if (ptr)
|
if (ptr)
|
||||||
diff = ptr - buffer + 1;
|
diff = ptr - buffer + 1;
|
||||||
else
|
else
|
||||||
@ -183,7 +184,7 @@ readline(int fd, char **whole_buffer)
|
|||||||
goto CLEANUP;
|
goto CLEANUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
line_ptr->data = safemalloc(diff);
|
line_ptr->data = (char*)safemalloc(diff);
|
||||||
if (!line_ptr->data) {
|
if (!line_ptr->data) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto CLEANUP;
|
goto CLEANUP;
|
||||||
@ -197,7 +198,8 @@ readline(int fd, char **whole_buffer)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
line_ptr->next = safecalloc(sizeof(struct read_lines_s), 1);
|
line_ptr->next =
|
||||||
|
(struct read_lines_s*)safecalloc(sizeof(struct read_lines_s), 1);
|
||||||
if (!line_ptr->next) {
|
if (!line_ptr->next) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto CLEANUP;
|
goto CLEANUP;
|
||||||
@ -205,7 +207,7 @@ readline(int fd, char **whole_buffer)
|
|||||||
line_ptr = line_ptr->next;
|
line_ptr = line_ptr->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
*whole_buffer = safemalloc(whole_buffer_len + 1);
|
*whole_buffer = (char*)safemalloc(whole_buffer_len + 1);
|
||||||
if (!*whole_buffer) {
|
if (!*whole_buffer) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto CLEANUP;
|
goto CLEANUP;
|
||||||
|
27
src/reqs.c
27
src/reqs.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: reqs.c,v 1.105 2003-06-26 18:19:57 rjkaes Exp $
|
/* $Id: reqs.c,v 1.106 2003-07-31 23:38:28 rjkaes Exp $
|
||||||
*
|
*
|
||||||
* This is where all the work in tinyproxy is actually done. Incoming
|
* This is where all the work in tinyproxy is actually done. Incoming
|
||||||
* connections have a new child created for them. The child then
|
* connections have a new child created for them. The child then
|
||||||
@ -128,7 +128,7 @@ check_allowed_connect_ports(int port)
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
for (i = 0; i != vector_length(ports_allowed_by_connect); ++i) {
|
for (i = 0; i != vector_length(ports_allowed_by_connect); ++i) {
|
||||||
data = vector_getentry(ports_allowed_by_connect, i, NULL);
|
data = (int*)vector_getentry(ports_allowed_by_connect, i, NULL);
|
||||||
if (!data)
|
if (!data)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -225,8 +225,8 @@ strip_username_password(char* host)
|
|||||||
static int
|
static int
|
||||||
extract_http_url(const char *url, struct request_s *request)
|
extract_http_url(const char *url, struct request_s *request)
|
||||||
{
|
{
|
||||||
request->host = safemalloc(strlen(url) + 1);
|
request->host = (char*)safemalloc(strlen(url) + 1);
|
||||||
request->path = safemalloc(strlen(url) + 1);
|
request->path = (char*)safemalloc(strlen(url) + 1);
|
||||||
|
|
||||||
if (!request->host || !request->path)
|
if (!request->host || !request->path)
|
||||||
goto ERROR_EXIT;
|
goto ERROR_EXIT;
|
||||||
@ -267,7 +267,7 @@ extract_http_url(const char *url, struct request_s *request)
|
|||||||
static int
|
static int
|
||||||
extract_ssl_url(const char *url, struct request_s *request)
|
extract_ssl_url(const char *url, struct request_s *request)
|
||||||
{
|
{
|
||||||
request->host = safemalloc(strlen(url) + 1);
|
request->host = (char*)safemalloc(strlen(url) + 1);
|
||||||
if (!request->host)
|
if (!request->host)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -318,7 +318,8 @@ void
|
|||||||
upstream_add(const char *host, int port, const char *domain)
|
upstream_add(const char *host, int port, const char *domain)
|
||||||
{
|
{
|
||||||
char *ptr;
|
char *ptr;
|
||||||
struct upstream *up = safemalloc(sizeof (struct upstream));
|
struct upstream *up =
|
||||||
|
(struct upstream*)safemalloc(sizeof (struct upstream));
|
||||||
|
|
||||||
if (!up) {
|
if (!up) {
|
||||||
log_message(LOG_ERR, "Unable to allocate memory in upstream_add()");
|
log_message(LOG_ERR, "Unable to allocate memory in upstream_add()");
|
||||||
@ -522,15 +523,15 @@ process_request(struct conn_s *connptr, hashmap_t hashofheaders)
|
|||||||
size_t request_len;
|
size_t request_len;
|
||||||
|
|
||||||
/* NULL out all the fields so frees don't cause segfaults. */
|
/* NULL out all the fields so frees don't cause segfaults. */
|
||||||
request = safecalloc(1, sizeof(struct request_s));
|
request = (struct request_s*)safecalloc(1, sizeof(struct request_s));
|
||||||
if (!request)
|
if (!request)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
request_len = strlen(connptr->request_line) + 1;
|
request_len = strlen(connptr->request_line) + 1;
|
||||||
|
|
||||||
request->method = safemalloc(request_len);
|
request->method = (char*)safemalloc(request_len);
|
||||||
url = safemalloc(request_len);
|
url = (char*)safemalloc(request_len);
|
||||||
request->protocol = safemalloc(request_len);
|
request->protocol = (char*)safemalloc(request_len);
|
||||||
|
|
||||||
if (!request->method || !url || !request->protocol) {
|
if (!request->method || !url || !request->protocol) {
|
||||||
safefree(url);
|
safefree(url);
|
||||||
@ -775,7 +776,7 @@ pull_client_data(struct conn_s *connptr, long int length)
|
|||||||
char *buffer;
|
char *buffer;
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
|
|
||||||
buffer = safemalloc(min(MAXBUFFSIZE, length));
|
buffer = (char*)safemalloc(min(MAXBUFFSIZE, length));
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -1443,7 +1444,7 @@ connect_to_upstream(struct conn_s *connptr, struct request_s *request)
|
|||||||
if (connptr->connect_method) {
|
if (connptr->connect_method) {
|
||||||
len = strlen(request->host) + 7;
|
len = strlen(request->host) + 7;
|
||||||
|
|
||||||
combined_string = safemalloc(len);
|
combined_string = (char*)safemalloc(len);
|
||||||
if (!combined_string) {
|
if (!combined_string) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1452,7 +1453,7 @@ connect_to_upstream(struct conn_s *connptr, struct request_s *request)
|
|||||||
request->port);
|
request->port);
|
||||||
} else {
|
} else {
|
||||||
len = strlen(request->host) + strlen(request->path) + 14;
|
len = strlen(request->host) + strlen(request->path) + 14;
|
||||||
combined_string = safemalloc(len);
|
combined_string = (char*)safemalloc(len);
|
||||||
if (!combined_string) {
|
if (!combined_string) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: stats.c,v 1.13 2003-03-13 21:31:03 rjkaes Exp $
|
/* $Id: stats.c,v 1.14 2003-07-31 23:38:28 rjkaes Exp $
|
||||||
*
|
*
|
||||||
* This module handles the statistics for tinyproxy. There are only two
|
* This module handles the statistics for tinyproxy. There are only two
|
||||||
* public API functions. The reason for the functions, rather than just a
|
* public API functions. The reason for the functions, rather than just a
|
||||||
@ -45,7 +45,7 @@ static struct stat_s *stats;
|
|||||||
void
|
void
|
||||||
init_stats(void)
|
init_stats(void)
|
||||||
{
|
{
|
||||||
stats = malloc_shared_memory(sizeof(struct stat_s));
|
stats = (struct stat_s*)malloc_shared_memory(sizeof(struct stat_s));
|
||||||
if (stats == MAP_FAILED)
|
if (stats == MAP_FAILED)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ showstats(struct conn_s *connptr)
|
|||||||
snprintf(refused, sizeof(refused), "%lu", stats->num_refused);
|
snprintf(refused, sizeof(refused), "%lu", stats->num_refused);
|
||||||
|
|
||||||
if (!config.statpage || (!(statfile = fopen(config.statpage, "r")))) {
|
if (!config.statpage || (!(statfile = fopen(config.statpage, "r")))) {
|
||||||
message_buffer = safemalloc(MAXBUFFSIZE);
|
message_buffer = (char*)safemalloc(MAXBUFFSIZE);
|
||||||
if (!message_buffer)
|
if (!message_buffer)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: vector.c,v 1.9 2003-05-30 16:21:48 rjkaes Exp $
|
/* $Id: vector.c,v 1.10 2003-07-31 23:38:28 rjkaes Exp $
|
||||||
*
|
*
|
||||||
* A vector implementation. The vector can be of an arbitrary length, and
|
* A vector implementation. The vector can be of an arbitrary length, and
|
||||||
* the data for each entry is an lump of data (the size is stored in the
|
* the data for each entry is an lump of data (the size is stored in the
|
||||||
@ -58,7 +58,7 @@ vector_create(void)
|
|||||||
{
|
{
|
||||||
vector_t vector;
|
vector_t vector;
|
||||||
|
|
||||||
vector = safemalloc(sizeof(struct vector_s));
|
vector = (vector_t)safemalloc(sizeof(struct vector_s));
|
||||||
if (!vector)
|
if (!vector)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ vector_insert(vector_t vector, void *data, ssize_t len, int pos)
|
|||||||
(pos != INSERT_PREPEND && pos != INSERT_APPEND))
|
(pos != INSERT_PREPEND && pos != INSERT_APPEND))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
entry = safemalloc(sizeof(struct vectorentry_s));
|
entry = (struct vectorentry_s*)safemalloc(sizeof(struct vectorentry_s));
|
||||||
if (!entry)
|
if (!entry)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user