From: wessels <> Date: Tue, 28 Oct 1997 05:53:09 +0000 (+0000) Subject: remove UNUSED_CODE and OLD_CODE sections X-Git-Tag: SQUID_3_0_PRE1~4663 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c91b9eff2d3a389f10f92d78f7988758520859c5;p=thirdparty%2Fsquid.git remove UNUSED_CODE and OLD_CODE sections --- diff --git a/src/disk.cc b/src/disk.cc index 4128da6e8c..8fd64cfdae 100644 --- a/src/disk.cc +++ b/src/disk.cc @@ -1,5 +1,5 @@ /* - * $Id: disk.cc,v 1.87 1997/10/25 17:22:38 wessels Exp $ + * $Id: disk.cc,v 1.88 1997/10/27 22:53:09 wessels Exp $ * * DEBUG: section 6 Disk I/O Routines * AUTHOR: Harvest Derived @@ -119,31 +119,12 @@ typedef struct open_ctrl_t { char *path; } open_ctrl_t; -#if UNUSED_CODE -typedef struct _dwalk_ctrl { - int fd; - off_t offset; - int cur_len; - char *buf; /* line buffer */ - FILE_WALK_HD *handler; - void *client_data; - FILE_WALK_LHD *line_handler; - void *line_data; -} dwalk_ctrl; - -#endif - static AIOCB diskHandleWriteComplete; static AIOCB diskHandleReadComplete; static PF diskHandleRead; static PF diskHandleWrite; static void file_open_complete(void *, int, int); -#if UNUSED_CODE -static AIOCB diskHandleWalkComplete; -static PF diskHandleWalk; -#endif - /* initialize table */ int disk_init(void) @@ -482,121 +463,6 @@ file_read(int fd, char *buf, int req_len, int offset, DRCB * handler, void *clie return DISK_OK; } - -#if UNUSED_CODE -/* Read from FD and pass a line to routine. Walk to EOF. */ -static void -diskHandleWalk(int fd, void *data) -{ - dwalk_ctrl *walk_dat = data; -#if !USE_ASYNC_IO - int len; -#endif - disk_ctrl_t *ctrlp = xcalloc(1, sizeof(disk_ctrl_t)); - ctrlp->fd = fd; - ctrlp->data = walk_dat; -#if USE_ASYNC_IO - aioRead(fd, - walk_dat->buf, - DISK_LINE_LEN - 1, - diskHandleWalkComplete, - ctrlp); -#else - len = read(fd, walk_dat->buf, DISK_LINE_LEN - 1); - diskHandleWalkComplete(ctrlp, len, errno); -#endif -} -#endif - -#if UNUSED_CODE -static void -diskHandleWalkComplete(void *data, int retcode, int errcode) -{ - disk_ctrl_t *ctrlp = (disk_ctrl_t *) data; - dwalk_ctrl *walk_dat; - int fd; - int len; - LOCAL_ARRAY(char, temp_line, DISK_LINE_LEN); - int end_pos; - int st_pos; - int used_bytes; - walk_dat = (dwalk_ctrl *) ctrlp->data; - fd = ctrlp->fd; - len = retcode; - errno = errcode; - xfree(data); - if (len < 0) { - if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) { - commSetSelect(fd, COMM_SELECT_READ, diskHandleWalk, walk_dat, 0); - return; - } - debug(50, 1) ("diskHandleWalk: FD %d: error readingd: %s\n", - fd, xstrerror()); - walk_dat->handler(fd, DISK_ERROR, walk_dat->client_data); - safe_free(walk_dat->buf); - safe_free(walk_dat); - return; - } else if (len == 0) { - /* EOF */ - walk_dat->handler(fd, DISK_EOF, walk_dat->client_data); - safe_free(walk_dat->buf); - safe_free(walk_dat); - return; - } - /* emulate fgets here. Cut the into separate line. newline is excluded */ - /* it throws last partial line, if exist, away. */ - used_bytes = st_pos = end_pos = 0; - while (end_pos < len) { - if (walk_dat->buf[end_pos] == '\n') { - /* new line found */ - xstrncpy(temp_line, walk_dat->buf + st_pos, end_pos - st_pos + 1); - used_bytes += end_pos - st_pos + 1; - /* invoke line handler */ - walk_dat->line_handler(fd, temp_line, strlen(temp_line), - walk_dat->line_data); - /* skip to next line */ - st_pos = end_pos + 1; - } - end_pos++; - } - /* update file pointer to the next to be read character */ - walk_dat->offset += used_bytes; - /* reschedule it for next line. */ - commSetSelect(fd, COMM_SELECT_READ, diskHandleWalk, walk_dat, 0); -} -#endif - -#if UNUSED_CODE -/* start walk through whole file operation - * read one block and chop it to a line and pass it to provided - * handler one line at a time. - * call a completion handler when done. */ -int -file_walk(int fd, - FILE_WALK_HD * handler, - void *client_data, - FILE_WALK_LHD * line_handler, - void *line_data) -{ - dwalk_ctrl *walk_dat; - walk_dat = xcalloc(1, sizeof(dwalk_ctrl)); - walk_dat->fd = fd; - walk_dat->offset = 0; - walk_dat->buf = xcalloc(1, DISK_LINE_LEN); - walk_dat->cur_len = 0; - walk_dat->handler = handler; - walk_dat->client_data = client_data; - walk_dat->line_handler = line_handler; - walk_dat->line_data = line_data; -#if USE_ASYNC_IO - diskHandleWalk(fd, walk_dat); -#else - commSetSelect(fd, COMM_SELECT_READ, diskHandleWalk, walk_dat, 0); -#endif - return DISK_OK; -} -#endif - int diskWriteIsComplete(int fd) { diff --git a/src/http.cc b/src/http.cc index ccd056804e..1b96573626 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,6 +1,6 @@ /* - * $Id: http.cc,v 1.203 1997/10/27 22:49:49 wessels Exp $ + * $Id: http.cc,v 1.204 1997/10/27 22:53:10 wessels Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -456,14 +456,6 @@ httpCheckPublic(struct _http_reply *reply, HttpStateData * httpState) return 1; if (reply->expires > -1) return 1; -#ifdef OLD_CODE - if (entry->mem_obj->request->protocol != PROTO_HTTP) - /* XXX Remove this check after a while. DW 8/21/96 - * We won't keep some FTP objects from neighbors running - * 1.0.8 or earlier because their ftpget's don't - * add a Date: field */ - return 1; -#endif else return 0; break; diff --git a/src/stat.cc b/src/stat.cc index 8b077b6b2d..921d35a2f7 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -1,6 +1,6 @@ /* - * $Id: stat.cc,v 1.162 1997/10/25 17:22:59 wessels Exp $ + * $Id: stat.cc,v 1.163 1997/10/27 22:53:12 wessels Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -337,9 +337,6 @@ statObjects(StoreEntry * sentry, int vm_or_not) int N = 0; int i; struct _store_client *sc; -#if OLD_CODE - storeAppendPrintf(sentry, open_bracket); -#endif for (entry = storeGetFirst(); entry != NULL; entry = storeGetNext()) { mem = entry->mem_obj; if (vm_or_not && mem == NULL) @@ -347,17 +344,6 @@ statObjects(StoreEntry * sentry, int vm_or_not) if ((++N & 0xFF) == 0) { debug(18, 3) ("stat_objects_get: Processed %d objects...\n", N); } -#if OLD_CODE - storeAppendPrintf(sentry, "{%s %dL %-25s %s %3d %2d %8d %s}\n", - describeStatuses(entry), - (int) entry->lock_count, - describeFlags(entry), - describeTimestamps(entry), - (int) entry->refcount, - storePendingNClients(entry), - mem ? mem->inmem_hi : entry->object_len, - entry->url); -#else storeAppendPrintf(sentry, "%s %s\n", RequestMethodStr[entry->method], entry->url); storeAppendPrintf(sentry, "\t%s\n", describeStatuses(entry)); @@ -391,11 +377,7 @@ statObjects(StoreEntry * sentry, int vm_or_not) storeAppendPrintf(sentry, "\t\tswapin_fd: %d\n", (int) sc->swapin_fd); } -#endif } -#if OLD_CODE - storeAppendPrintf(sentry, close_bracket); -#endif } void