From 2daae1369d453e05cffade1b0bda99cedff508eb Mon Sep 17 00:00:00 2001 From: wessels <> Date: Sat, 13 Apr 1996 03:41:37 +0000 Subject: [PATCH] remove __FILE__, __LINE__ debugging from some functions --- src/ftp.cc | 18 +++++++++--------- src/gopher.cc | 22 +++++++++++----------- src/http.cc | 24 ++++++++++++------------ src/stmem.cc | 36 +++++++++++------------------------- src/store.cc | 35 ++++++++++++++++------------------- src/wais.cc | 4 ++-- 6 files changed, 61 insertions(+), 78 deletions(-) diff --git a/src/ftp.cc b/src/ftp.cc index 15649479f9..237c588c53 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -1,4 +1,4 @@ -/* $Id: ftp.cc,v 1.33 1996/04/10 20:53:45 wessels Exp $ */ +/* $Id: ftp.cc,v 1.34 1996/04/12 21:41:37 wessels Exp $ */ /* * DEBUG: Section 9 ftp: FTP @@ -41,11 +41,11 @@ static void ftpCloseAndFree(fd, data) comm_close(fd); if (data) { if (data->reply_hdr) { - put_free_8k_page(data->reply_hdr, __FILE__, __LINE__); + put_free_8k_page(data->reply_hdr); data->reply_hdr = NULL; } if (data->icp_page_ptr) { - put_free_8k_page(data->icp_page_ptr, __FILE__, __LINE__); + put_free_8k_page(data->icp_page_ptr); data->icp_page_ptr = NULL; } if (data->icp_rwd_ptr) @@ -167,7 +167,7 @@ static void ftpProcessReplyHeader(data, buf, size) debug(11, 3, "ftpProcessReplyHeader: key '%s'\n", entry->key); if (data->reply_hdr == NULL) { - data->reply_hdr = get_free_8k_page(__FILE__, __LINE__); + data->reply_hdr = get_free_8k_page(); memset(data->reply_hdr, '\0', 8192); } if (data->reply_hdr_state == 0) { @@ -262,7 +262,7 @@ static void ftpProcessReplyHeader(data, buf, size) storeSetPrivateKey(entry); storeExpireNow(entry); BIT_RESET(entry->flag, CACHABLE); - storeReleaseRequest(entry, __FILE__, __LINE__); + storeReleaseRequest(entry); break; default: /* These can be negative cached, make key public */ @@ -329,7 +329,7 @@ int ftpReadReply(fd, data) * by `ftpget'. */ } else { BIT_RESET(entry->flag, CACHABLE); - storeReleaseRequest(entry, __FILE__, __LINE__); + storeReleaseRequest(entry); cached_error_entry(entry, ERR_READ_ERROR, xstrerror()); ftpCloseAndFree(fd, data); } @@ -347,7 +347,7 @@ int ftpReadReply(fd, data) debug(9, 1, "ftpReadReply: Didn't see magic marker, purging .\n", entry->url); entry->expires = cached_curtime + getNegativeTTL(); BIT_RESET(entry->flag, CACHABLE); - storeReleaseRequest(entry, __FILE__, __LINE__); + storeReleaseRequest(entry); } else if (!(entry->flag & DELETE_BEHIND)) { entry->expires = cached_curtime + ttlSet(entry); } @@ -407,7 +407,7 @@ void ftpSendComplete(fd, buf, size, errflag, data) fd, size, errflag); if (buf) { - put_free_8k_page(buf, __FILE__, __LINE__); /* Allocated by ftpSendRequest. */ + put_free_8k_page(buf); /* Allocated by ftpSendRequest. */ buf = NULL; } data->icp_page_ptr = NULL; /* So lifetime expire doesn't re-free */ @@ -450,7 +450,7 @@ void ftpSendRequest(fd, data) debug(9, 5, "ftpSendRequest: FD %d\n", fd); buflen = strlen(data->request) + 256; - buf = (char *) get_free_8k_page(__FILE__, __LINE__); + buf = (char *) get_free_8k_page(); data->icp_page_ptr = buf; memset(buf, '\0', buflen); diff --git a/src/gopher.cc b/src/gopher.cc index b7ae2e3a87..da8c993c4f 100644 --- a/src/gopher.cc +++ b/src/gopher.cc @@ -1,4 +1,4 @@ -/* $Id: gopher.cc,v 1.24 1996/04/11 04:47:22 wessels Exp $ */ +/* $Id: gopher.cc,v 1.25 1996/04/12 21:41:37 wessels Exp $ */ /* * DEBUG: Section 10 gopher: GOPHER @@ -72,7 +72,7 @@ static void gopherCloseAndFree(fd, data) { if (fd > +0) comm_close(fd); - put_free_4k_page(data->buf, __FILE__, __LINE__); + put_free_4k_page(data->buf); xfree(data); } @@ -569,7 +569,7 @@ int gopherReadReplyTimeout(fd, data) debug(10, 4, "GopherReadReplyTimeout: Timeout on %d\n url: %s\n", fd, entry->url); cached_error_entry(entry, ERR_READ_TIMEOUT, NULL); if (data->icp_page_ptr) - put_free_4k_page(data->icp_page_ptr, __FILE__, __LINE__); + put_free_4k_page(data->icp_page_ptr); if (data->icp_rwd_ptr) safe_free(data->icp_rwd_ptr); gopherCloseAndFree(fd, data); @@ -586,7 +586,7 @@ void gopherLifetimeExpire(fd, data) debug(10, 4, "gopherLifeTimeExpire: FD %d: \n", fd, entry->url); cached_error_entry(entry, ERR_LIFETIME_EXP, NULL); if (data->icp_page_ptr) - put_free_4k_page(data->icp_page_ptr, __FILE__, __LINE__); + put_free_4k_page(data->icp_page_ptr); if (data->icp_rwd_ptr) safe_free(data->icp_rwd_ptr); comm_set_select_handler(fd, @@ -644,7 +644,7 @@ int gopherReadReply(fd, data) return 0; } } - buf = get_free_4k_page(__FILE__, __LINE__); + buf = get_free_4k_page(); errno = 0; len = read(fd, buf, TEMP_BUF_SIZE - 1); /* leave one space for \0 in gopherToHTML */ debug(10, 5, "gopherReadReply: FD %d read len=%d\n", fd, len); @@ -660,7 +660,7 @@ int gopherReadReply(fd, data) (PF) gopherReadReplyTimeout, (void *) data, getReadTimeout()); } else { BIT_RESET(entry->flag, CACHABLE); - storeReleaseRequest(entry, __FILE__, __LINE__); + storeReleaseRequest(entry); cached_error_entry(entry, ERR_READ_ERROR, xstrerror()); gopherCloseAndFree(fd, data); } @@ -726,7 +726,7 @@ int gopherReadReply(fd, data) (void *) data, getReadTimeout()); } - put_free_4k_page(buf, __FILE__, __LINE__); + put_free_4k_page(buf); return 0; } @@ -747,7 +747,7 @@ void gopherSendComplete(fd, buf, size, errflag, data) cached_error_entry(entry, ERR_CONNECT_FAIL, xstrerror()); gopherCloseAndFree(fd, data); if (buf) - put_free_4k_page(buf, __FILE__, __LINE__); /* Allocated by gopherSendRequest. */ + put_free_4k_page(buf); /* Allocated by gopherSendRequest. */ return; } /* @@ -800,7 +800,7 @@ void gopherSendComplete(fd, buf, size, errflag, data) comm_set_fd_lifetime(fd, -1); /* disable */ if (buf) - put_free_4k_page(buf, __FILE__, __LINE__); /* Allocated by gopherSendRequest. */ + put_free_4k_page(buf); /* Allocated by gopherSendRequest. */ data->icp_page_ptr = NULL; data->icp_rwd_ptr = NULL; } @@ -812,7 +812,7 @@ void gopherSendRequest(fd, data) { int len; static char query[MAX_URL]; - char *buf = get_free_4k_page(__FILE__, __LINE__); + char *buf = get_free_4k_page(); data->icp_page_ptr = buf; @@ -927,6 +927,6 @@ int gopherStart(unusedfd, url, entry) GopherData *CreateGopherData() { GopherData *gd = (GopherData *) xcalloc(1, sizeof(GopherData)); - gd->buf = get_free_4k_page(__FILE__, __LINE__); + gd->buf = get_free_4k_page(); return (gd); } diff --git a/src/http.cc b/src/http.cc index 13b07cbafd..3bb8b37c71 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,4 +1,4 @@ -/* $Id: http.cc,v 1.43 1996/04/12 21:22:55 wessels Exp $ */ +/* $Id: http.cc,v 1.44 1996/04/12 21:41:38 wessels Exp $ */ /* * DEBUG: Section 11 http: HTTP @@ -34,11 +34,11 @@ static void httpCloseAndFree(fd, data) comm_close(fd); if (data) { if (data->reply_hdr) { - put_free_8k_page(data->reply_hdr, __FILE__, __LINE__); + put_free_8k_page(data->reply_hdr); data->reply_hdr = NULL; } if (data->icp_page_ptr) { - put_free_8k_page(data->icp_page_ptr, __FILE__, __LINE__); + put_free_8k_page(data->icp_page_ptr); data->icp_page_ptr = NULL; } if (data->icp_rwd_ptr) @@ -141,7 +141,7 @@ static void httpProcessReplyHeader(data, buf, size) debug(11, 3, "httpProcessReplyHeader: key '%s'\n", entry->key); if (data->reply_hdr == NULL) { - data->reply_hdr = get_free_8k_page(__FILE__, __LINE__); + data->reply_hdr = get_free_8k_page(); memset(data->reply_hdr, '\0', 8192); } if (data->reply_hdr_state == 0) { @@ -236,7 +236,7 @@ static void httpProcessReplyHeader(data, buf, size) storeSetPrivateKey(entry); storeExpireNow(entry); BIT_RESET(entry->flag, CACHABLE); - storeReleaseRequest(entry, __FILE__, __LINE__); + storeReleaseRequest(entry); break; default: /* These can be negative cached, make key public */ @@ -311,7 +311,7 @@ static void httpReadReply(fd, data) (PF) httpReadReplyTimeout, (void *) data, getReadTimeout()); } else { BIT_RESET(entry->flag, CACHABLE); - storeReleaseRequest(entry, __FILE__, __LINE__); + storeReleaseRequest(entry); cached_error_entry(entry, ERR_READ_ERROR, xstrerror()); httpCloseAndFree(fd, data); } @@ -375,7 +375,7 @@ static void httpSendComplete(fd, buf, size, errflag, data) fd, size, errflag); if (buf) { - put_free_8k_page(buf, __FILE__, __LINE__); /* Allocated by httpSendRequest. */ + put_free_8k_page(buf); /* Allocated by httpSendRequest. */ buf = NULL; } data->icp_page_ptr = NULL; /* So lifetime expire doesn't re-free */ @@ -431,7 +431,7 @@ static void httpSendRequest(fd, data) } /* Since we limit the URL read to a 4K page, I doubt that the * mime header could be longer than an 8K page */ - buf = (char *) get_free_8k_page(__FILE__, __LINE__); + buf = (char *) get_free_8k_page(); data->icp_page_ptr = buf; if (buflen > DISK_PAGE_SIZE) { debug(11, 0, "Mime header length %d is breaking ICP code\n", buflen); @@ -444,7 +444,7 @@ static void httpSendRequest(fd, data) xbuf = xstrdup(data->req_hdr); for (t = strtok(xbuf, crlf); t; t = strtok(NULL, crlf)) { if (strncasecmp(t, "User-Agent:", 11) == 0) { - ybuf = (char *) get_free_4k_page(__FILE__, __LINE__); + ybuf = (char *) get_free_4k_page(); memset(ybuf, '\0', SM_PAGE_SIZE); sprintf(ybuf, "%s %s %s", t, HARVEST_PROXY_TEXT, version_string); t = ybuf; @@ -457,12 +457,12 @@ static void httpSendRequest(fd, data) } xfree(xbuf); if (ybuf) { - put_free_4k_page(ybuf, __FILE__, __LINE__); + put_free_4k_page(ybuf); ybuf = NULL; } } /* Add Forwarded: header */ - ybuf = get_free_4k_page(__FILE__, __LINE__); + ybuf = get_free_4k_page(); if (data->entry->mem_obj) cfd = data->entry->mem_obj->fd_of_first_client; if (cfd < 0) { @@ -474,7 +474,7 @@ static void httpSendRequest(fd, data) } strcat(buf, ybuf); len += strlen(ybuf); - put_free_4k_page(ybuf, __FILE__, __LINE__); + put_free_4k_page(ybuf); ybuf = NULL; strcat(buf, crlf); diff --git a/src/stmem.cc b/src/stmem.cc index 0a85bac24a..9dab8c647d 100644 --- a/src/stmem.cc +++ b/src/stmem.cc @@ -1,4 +1,4 @@ -/* $Id: stmem.cc,v 1.8 1996/04/05 00:59:27 wessels Exp $ */ +/* $Id: stmem.cc,v 1.9 1996/04/12 21:41:40 wessels Exp $ */ /* * DEBUG: Section 19 stmem: @@ -25,13 +25,13 @@ void memFree(mem) lastp = p; p = p->next; if (lastp) { - put_free_4k_page(lastp->data, __FILE__, __LINE__); + put_free_4k_page(lastp->data); safe_free(lastp); } } if (p) { - put_free_4k_page(p->data, __FILE__, __LINE__); + put_free_4k_page(p->data); safe_free(p); } } @@ -47,12 +47,12 @@ void memFreeData(mem) while (p != mem->tail) { lastp = p; p = p->next; - put_free_4k_page(lastp->data, __FILE__, __LINE__); + put_free_4k_page(lastp->data); safe_free(lastp); } if (p != NULL) { - put_free_4k_page(p->data, __FILE__, __LINE__); + put_free_4k_page(p->data); safe_free(p); p = NULL; } @@ -77,7 +77,7 @@ int memFreeDataUpto(mem, target_offset) lastp = p; p = p->next; current_offset += lastp->len; - put_free_4k_page(lastp->data, __FILE__, __LINE__); + put_free_4k_page(lastp->data); safe_free(lastp); } } @@ -128,7 +128,7 @@ int memAppend(mem, data, len) p = (mem_node) xcalloc(1, sizeof(Mem_Node)); p->next = NULL; p->len = len_to_copy; - p->data = get_free_4k_page(__FILE__, __LINE__); + p->data = get_free_4k_page(); memcpy(p->data, data, len_to_copy); if (!mem->head) { @@ -273,9 +273,7 @@ mem_ptr memInit() /* PBD 12/95: Memory allocator routines for saving and reallocating fixed * size blocks rather than mallocing and freeing them */ -char *get_free_4k_page(file, line) - char *file; - int line; +char *get_free_4k_page() { char *page = NULL; @@ -292,17 +290,13 @@ char *get_free_4k_page(file, line) sm_stats.total_pages_allocated++; } sm_stats.n_pages_in_use++; - debug(19, 5, "get_free_4k_page: Giving out %p, count=%d %s:%d\n", - page, sm_stats.n_pages_in_use, file, line); if (page == NULL) fatal_dump("get_free_4k_page: Null page pointer?"); return (page); } -void put_free_4k_page(page, file, line) +void put_free_4k_page(page) char *page; - char *file; - int line; { static stack_overflow_warning_toggle; @@ -318,15 +312,12 @@ void put_free_4k_page(page, file, line) } } sm_stats.n_pages_in_use--; - debug(19, 5, "put_free_4k_page: Putting back %p, count=%d %s:%d\n", page, sm_stats.n_pages_in_use, file, line); /* Call push regardless if it's full, cause it's just going to release the * page if stack is full */ push(&sm_stats.free_page_stack, page); } -char *get_free_8k_page(file, line) - char *file; - int line; +char *get_free_8k_page() { char *page = NULL; @@ -343,17 +334,13 @@ char *get_free_8k_page(file, line) disk_stats.total_pages_allocated++; } disk_stats.n_pages_in_use++; - debug(19, 5, "get_free_8k_page: Giving out %p, count=%d %s:%d\n", - page, disk_stats.n_pages_in_use, file, line); if (page == NULL) fatal_dump("get_free_8k_page: Null page pointer?"); return (page); } -void put_free_8k_page(page, file, line) +void put_free_8k_page(page) char *page; - char *file; - int line; { static stack_overflow_warning_toggle; @@ -370,7 +357,6 @@ void put_free_8k_page(page, file, line) } } disk_stats.n_pages_in_use--; - debug(19, 5, "put_free_8k_page: Putting back %p, count=%d %s:%d\n", page, disk_stats.n_pages_in_use, file, line); /* Call push regardless if it's full, cause it's just going to release the * page if stack is full */ push(&disk_stats.free_page_stack, page); diff --git a/src/store.cc b/src/store.cc index 15ba179606..fe43e27a85 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1,6 +1,6 @@ -/* $Id: store.cc,v 1.48 1996/04/12 21:22:58 wessels Exp $ */ -#ident "$Id: store.cc,v 1.48 1996/04/12 21:22:58 wessels Exp $" +/* $Id: store.cc,v 1.49 1996/04/12 21:41:42 wessels Exp $ */ +#ident "$Id: store.cc,v 1.49 1996/04/12 21:41:42 wessels Exp $" /* * DEBUG: Section 20 store @@ -423,15 +423,12 @@ int storeLockObject(e) return status; } -void storeReleaseRequest(e, file, line) +void storeReleaseRequest(e) StoreEntry *e; - char *file; - int line; { if (e->flag & RELEASE_REQUEST) return; - debug(20, 3, "storeReleaseRequest: FROM %s:%d FOR '%s'\n", - file, line, e->key ? e->key : e->url); + debug(20, 3, "storeReleaseRequest: FOR '%s'\n", e->key ? e->key : e->url); e->flag |= RELEASE_REQUEST; } @@ -580,7 +577,7 @@ void storeSetPublicKey(e) debug(20, 0, "storeSetPublicKey: Making old '%s' private.\n", newkey); e2 = (StoreEntry *) table_entry; storeSetPrivateKey(e2); - storeReleaseRequest(e2, __FILE__, __LINE__); + storeReleaseRequest(e2); } if (e->key) storeHashDelete(e); @@ -626,7 +623,7 @@ StoreEntry *storeCreateEntry(url, req_hdr, flags, method) BIT_RESET(e->flag, ENTRY_PRIVATE); } else { BIT_RESET(e->flag, CACHABLE); - storeReleaseRequest(e, __FILE__, __LINE__); + storeReleaseRequest(e); BIT_SET(e->flag, ENTRY_PRIVATE); } if (neighbors_do_private_keys || !BIT_TEST(flags, REQ_PUBLIC)) @@ -891,7 +888,7 @@ void storeStartDeleteBehind(e) /* change its key, so it couldn't be found by other client */ storeSetPrivateKey(e); BIT_SET(e->flag, DELETE_BEHIND); - storeReleaseRequest(e, __FILE__, __LINE__); + storeReleaseRequest(e); BIT_RESET(e->flag, CACHABLE); storeExpireNow(e); } @@ -987,7 +984,7 @@ int storeSwapInHandle(fd_notused, buf, len, flag, e, offset_notused) if ((flag < 0) && (flag != DISK_EOF)) { debug(20, 0, "storeSwapInHandle: SwapIn failure (err code = %d).\n", flag); - put_free_8k_page(e->mem_obj->e_swap_buf, __FILE__, __LINE__); + put_free_8k_page(e->mem_obj->e_swap_buf); storeSetMemStatus(e, NOT_IN_MEMORY); file_close(e->mem_obj->swap_fd); swapInError(-1, e); /* Invokes storeAbort() and completes the I/O */ @@ -1017,7 +1014,7 @@ int storeSwapInHandle(fd_notused, buf, len, flag, e, offset_notused) } else { /* complete swapping in */ storeSetMemStatus(e, IN_MEMORY); - put_free_8k_page(e->mem_obj->e_swap_buf, __FILE__, __LINE__); + put_free_8k_page(e->mem_obj->e_swap_buf); file_close(e->mem_obj->swap_fd); storeLog(STORE_LOG_SWAPIN, e); debug(20, 5, "storeSwapInHandle: SwapIn complete: from %s.\n", @@ -1071,7 +1068,7 @@ int storeSwapInStart(e) storeSetMemStatus(e, SWAPPING_IN); e->mem_obj->data = new_MemObjectData(); e->mem_obj->swap_offset = 0; - e->mem_obj->e_swap_buf = get_free_8k_page(__FILE__, __LINE__); + e->mem_obj->e_swap_buf = get_free_8k_page(); /* start swapping daemon */ file_read(fd, @@ -1102,9 +1099,9 @@ void storeSwapOutHandle(fd, flag, e) debug(20, 1, "storeSwapOutHandle: SwapOut failure (err code = %d).\n", flag); e->swap_status = NO_SWAP; - put_free_8k_page(page_ptr, __FILE__, __LINE__); + put_free_8k_page(page_ptr); file_close(fd); - storeReleaseRequest(e, __FILE__, __LINE__); + storeReleaseRequest(e); if (e->swap_file_number != -1) { file_map_bit_reset(e->swap_file_number); safeunlink(filename, 0); /* remove it */ @@ -1139,7 +1136,7 @@ void storeSwapOutHandle(fd, flag, e) storeLog(STORE_LOG_SWAPOUT, e); debug(20, 5, "storeSwapOutHandle: SwapOut complete: to %s.\n", e->url, storeSwapFullPath(e->swap_file_number, NULL)); - put_free_8k_page(page_ptr, __FILE__, __LINE__); + put_free_8k_page(page_ptr); sprintf(logmsg, "%s %s %d %d %d\n", filename, e->url, @@ -1204,7 +1201,7 @@ static int storeSwapOutStart(e) } e->swap_status = SWAPPING_OUT; e->mem_obj->swap_offset = 0; - e->mem_obj->e_swap_buf = get_free_8k_page(__FILE__, __LINE__); + e->mem_obj->e_swap_buf = get_free_8k_page(); e->mem_obj->e_swap_buf_len = 0; storeCopy(e, 0, SWAP_BUF, e->mem_obj->e_swap_buf, @@ -1436,7 +1433,7 @@ static int storeCheckSwapable(e) } else return 1; - storeReleaseRequest(e, __FILE__, __LINE__); + storeReleaseRequest(e); BIT_RESET(e->flag, CACHABLE); return 0; } @@ -2032,7 +2029,7 @@ int storeRelease(e) if (storeEntryLocked(e)) { storeExpireNow(e); debug(20, 3, "storeRelease: Only setting RELEASE_REQUEST bit\n"); - storeReleaseRequest(e, __FILE__, __LINE__); + storeReleaseRequest(e); return -1; } if (e->key != NULL) { diff --git a/src/wais.cc b/src/wais.cc index 25bfe13e57..8d74b56c50 100644 --- a/src/wais.cc +++ b/src/wais.cc @@ -1,4 +1,4 @@ -/* $Id: wais.cc,v 1.23 1996/04/10 00:18:50 wessels Exp $ */ +/* $Id: wais.cc,v 1.24 1996/04/12 21:41:44 wessels Exp $ */ /* * DEBUG: Section 24 wais @@ -129,7 +129,7 @@ void waisReadReply(fd, data) (PF) waisReadReplyTimeout, (void *) data, getReadTimeout()); } else { BIT_RESET(entry->flag, CACHABLE); - storeReleaseRequest(entry, __FILE__, __LINE__); + storeReleaseRequest(entry); cached_error_entry(entry, ERR_READ_ERROR, xstrerror()); waisCloseAndFree(fd, data); } -- 2.47.3