From 4e3f29ebcad2966064d8161ec84628d71b7ea1de Mon Sep 17 00:00:00 2001 From: wessels <> Date: Thu, 30 Oct 1997 10:31:17 +0000 Subject: [PATCH] gindent and formatting --- include/splay.h | 6 +++--- lib/snprintf.c | 8 ++++---- lib/splay.c | 4 ++-- src/client.cc | 3 ++- src/client_side.cc | 3 +-- src/errorpage.cc | 33 +++++++++++++++++++-------------- src/ftp.cc | 15 +-------------- src/http.cc | 11 +---------- src/pconn.cc | 7 ++++--- src/protos.h | 1 - src/ssl.cc | 9 ++------- src/tunnel.cc | 9 ++------- src/wais.cc | 19 ++----------------- 13 files changed, 43 insertions(+), 85 deletions(-) diff --git a/include/splay.h b/include/splay.h index d2ae8d58e8..f1d22fa2d1 100644 --- a/include/splay.h +++ b/include/splay.h @@ -5,10 +5,10 @@ typedef struct _splay_node { struct _splay_node *right; } splayNode; -typedef int (*SPCMP)(const void *, splayNode *); +typedef int SPCMP (const void *, splayNode *); extern int splayLastResult; -splayNode *splay_insert(void *, splayNode *, SPCMP); -splayNode *splay_splay(const void *, splayNode *, SPCMP); +splayNode *splay_insert(void *, splayNode *, SPCMP *); +splayNode *splay_splay(const void *, splayNode *, SPCMP* ); void splay_destroy(splayNode *, void (*)(void *)); diff --git a/lib/snprintf.c b/lib/snprintf.c index 48d8953ecb..75bbbd1629 100644 --- a/lib/snprintf.c +++ b/lib/snprintf.c @@ -512,7 +512,7 @@ conv_p2(register u_wide_int num, register int nbits, /* * Do format conversion placing the output in buffer */ -static int +static int format_converter(register buffy * odp, const char *fmt, va_list ap) { @@ -879,7 +879,7 @@ format_converter(register buffy * odp, const char *fmt, /* * This is the general purpose conversion function. */ -static void +static void strx_printv(int *ccp, char *buf, size_t len, const char *format, va_list ap) { @@ -906,7 +906,7 @@ strx_printv(int *ccp, char *buf, size_t len, const char *format, #endif #if !HAVE_SNPRINTF -int +int snprintf(char *buf, size_t len, const char *format,...) { int cc; @@ -919,7 +919,7 @@ snprintf(char *buf, size_t len, const char *format,...) #endif #if !HAVE_VSNPRINTF -int +int vsnprintf(char *buf, size_t len, const char *format, va_list ap) { diff --git a/lib/splay.c b/lib/splay.c index 400925010d..72b439950a 100644 --- a/lib/splay.c +++ b/lib/splay.c @@ -17,7 +17,7 @@ int splayLastResult = 0; splayNode * -splay_insert(void *data, splayNode * top, SPCMP compare) +splay_insert(void *data, splayNode * top, SPCMP *compare) { splayNode *new = xcalloc(sizeof(splayNode), 1); new->data = data; @@ -44,7 +44,7 @@ splay_insert(void *data, splayNode * top, SPCMP compare) } splayNode * -splay_splay(const void *data, splayNode * top, SPCMP compare) +splay_splay(const void *data, splayNode * top, SPCMP *compare) { splayNode N; splayNode *l; diff --git a/src/client.cc b/src/client.cc index d5d98d7dfc..0d3f09fde5 100644 --- a/src/client.cc +++ b/src/client.cc @@ -1,7 +1,8 @@ + /* - * $Id: client.cc,v 1.38 1997/10/30 00:51:03 wessels Exp $ + * $Id: client.cc,v 1.39 1997/10/30 03:31:19 wessels Exp $ * * DEBUG: section 0 WWW Client * AUTHOR: Harvest Derived diff --git a/src/client_side.cc b/src/client_side.cc index c9f142660e..ebefcb099b 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.136 1997/10/30 02:40:57 wessels Exp $ + * $Id: client_side.cc,v 1.137 1997/10/30 03:31:19 wessels Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -100,7 +100,6 @@ clientAccessCheckDone(int answer, void *data) err->src_addr = http->conn->peer.sin_addr; err->redirect_url = xstrdup(redirectUrl); errorSend(fd, err); - } else { /* NOTE: don't use HTTP_UNAUTHORIZED because then the * stupid browser wants us to authenticate */ diff --git a/src/errorpage.cc b/src/errorpage.cc index e0135532f1..3df4a9ef02 100644 --- a/src/errorpage.cc +++ b/src/errorpage.cc @@ -1,6 +1,6 @@ /* - * $Id: errorpage.cc,v 1.95 1997/10/30 02:40:58 wessels Exp $ + * $Id: errorpage.cc,v 1.96 1997/10/30 03:31:20 wessels Exp $ * * DEBUG: section 4 Error Generation * AUTHOR: Duane Wessels @@ -30,10 +30,10 @@ */ /* - * Abstract: These routines are used to generate error messages to be - * sent to clients. The error type is used to select between - * the various message formats. (formats are stored in the - * Config.errorDirectory) + * Abstract: These routines are used to generate error messages to be + * sent to clients. The error type is used to select between + * the various message formats. (formats are stored in the + * Config.errorDirectory) */ #include "squid.h" @@ -123,9 +123,10 @@ errorCon(err_type type, http_status status) * Arguments: err - This object is destroyed after use in this function. * * Abstract: This function generates a error page from the info contained - * by 'err' and then attaches it to the specified 'entry' - * - * Note: The above abstract is should be check for correctness!!!! + * by 'err' and then stores the text in the specified store + * entry. This function should only be called by ``server + * side routines'' which need to communicate errors to the + * client side. The client side should call errorSend(). */ void errorAppendEntry(StoreEntry * entry, ErrorState * err) @@ -134,6 +135,9 @@ errorAppendEntry(StoreEntry * entry, ErrorState * err) MemObject *mem = entry->mem_obj; int len; assert(entry->store_status == STORE_PENDING); +#if WE_SHOULD_PROBABLY_REQUIRE_THIS + assert(mem->inmem_hi == 0); +#endif buf = errorBuildBuf(err, &len); storeAppend(entry, buf, len); if (mem) @@ -149,11 +153,11 @@ errorAppendEntry(StoreEntry * entry, ErrorState * err) * * Abstract: This function generates a error page from the info contained * by 'err' and then sends it to the client. - * - * Note: The callback function errorSendComplete() cleans up 'err' - * - * Note: I don't think we need to add 'err' to the callback table - * since the only path ends up a errorSendComplete(). + * The callback function errorSendComplete() is called after + * the page has been written to the client socket (fd). + * errorSendComplete() deallocates 'err'. We need to add + * 'err' to the cbdata because comm_write() requires it + * for all callback data pointers. */ void errorSend(int fd, ErrorState * err) @@ -170,7 +174,8 @@ errorSend(int fd, ErrorState * err) /* * Function: errorSendComplete * - * Abstract: This function + * Abstract: Called by commHandleWrite() after data has been written + * to the client socket. * * Note: If there is a callback, the callback is responsible for * closeing the FD, otherwise we do it ourseves. diff --git a/src/ftp.cc b/src/ftp.cc index f188af1f05..623308a973 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -1,6 +1,6 @@ /* - * $Id: ftp.cc,v 1.159 1997/10/30 02:49:00 wessels Exp $ + * $Id: ftp.cc,v 1.160 1997/10/30 03:31:21 wessels Exp $ * * DEBUG: section 9 File Transfer Protocol (FTP) * AUTHOR: Harvest Derived @@ -662,7 +662,6 @@ ftpReadData(int fd, void *data) err->xerrno = errno; err->request = requestLink(ftpState->request); errorAppendEntry(entry, err); - storeAbort(entry, 0); ftpDataTransferDone(ftpState); } else if (len == 0) { @@ -795,7 +794,6 @@ ftpCleanupUrlpath(FtpStateData * ftpState) } while (again); } - static void ftpBuildTitleUrl(FtpStateData * ftpState) { @@ -821,7 +819,6 @@ ftpBuildTitleUrl(FtpStateData * ftpState) strcat(t, request->urlpath); } - void ftpStart(request_t * request, StoreEntry * entry) { @@ -868,12 +865,10 @@ ftpStart(request_t * request, StoreEntry * entry) url); if (fd == COMM_ERROR) { debug(9, 4) ("ftpStart: Failed to open a socket.\n"); - err = errorCon(ERR_SOCKET_FAILURE, HTTP_INTERNAL_SERVER_ERROR); err->xerrno = errno; err->request = requestLink(ftpState->request); errorAppendEntry(entry, err); - storeAbort(entry, 0); return; } @@ -897,23 +892,19 @@ ftpConnectDone(int fd, int status, void *data) debug(9, 3) ("ftpConnectDone, status = %d\n", status); if (status == COMM_ERR_DNS) { debug(9, 4) ("ftpConnectDone: Unknown host: %s\n", request->host); - err = errorCon(ERR_DNS_FAIL, HTTP_SERVICE_UNAVAILABLE); err->dnsserver_msg = xstrdup(dns_error_message); err->request = requestLink(request); errorAppendEntry(ftpState->entry, err); - storeAbort(ftpState->entry, 0); comm_close(fd); } else if (status != COMM_OK) { - err = errorCon(ERR_CONNECT_FAIL, HTTP_SERVICE_UNAVAILABLE); err->xerrno = errno; err->host = xstrdup(request->host); err->port = request->port; err->request = requestLink(request); errorAppendEntry(ftpState->entry, err); - storeAbort(ftpState->entry, 0); comm_close(fd); } else { @@ -931,7 +922,6 @@ ftpConnectDone(int fd, int status, void *data) /* ====================================================================== */ - static void ftpWriteCommand(const char *buf, FtpStateData * ftpState) { @@ -1357,7 +1347,6 @@ ftpPasvCallback(int fd, int status, void *data) err->port = ftpState->data.port; err->request = requestLink(request); errorAppendEntry(ftpState->entry, err); - storeAbort(ftpState->entry, 0); comm_close(fd); return; @@ -1584,7 +1573,6 @@ const char *ftpAuthText = "
from this cache. Please check with the\n" "cache administrator\n" "if you believe this is incorrect.\n" - "
\n" "%s\n" "