From: wessels <> Date: Fri, 19 Jul 1996 02:26:59 +0000 (+0000) Subject: use LOCAL_ARRAY macro X-Git-Tag: SQUID_3_0_PRE1~6033 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=95d659f064bba7df32231dd15422b2855083ca3f;p=thirdparty%2Fsquid.git use LOCAL_ARRAY macro --- diff --git a/src/acl.cc b/src/acl.cc index 759f994f5c..e76ef0a29b 100644 --- a/src/acl.cc +++ b/src/acl.cc @@ -1,5 +1,5 @@ /* - * $Id: acl.cc,v 1.16 1996/07/15 23:10:53 wessels Exp $ + * $Id: acl.cc,v 1.17 1996/07/18 20:26:59 wessels Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -197,7 +197,9 @@ static struct _acl_ip_data *aclParseIpList() struct _acl_ip_data *head = NULL; struct _acl_ip_data **Tail = &head; struct _acl_ip_data *q = NULL; - static char addr1[256], addr2[256], mask[256]; + LOCAL_ARRAY(char, addr1, 256); + LOCAL_ARRAY(char, addr2, 256); + LOCAL_ARRAY(char, mask, 256); while ((t = strtok(NULL, w_space))) { q = xcalloc(1, sizeof(struct _acl_ip_data)); @@ -568,7 +570,7 @@ static int aclMatchEndOfWord(data, word) debug(28, 3, "aclMatchEndOfWord: looking for '%s'\n", data->key); if ((offset = strlen(word) - strlen(data->key)) < 0) continue; - if (strcmp(word + offset, data->key) == 0) + if (strcasecmp(word + offset, data->key) == 0) return 1; } return 0; diff --git a/src/debug.cc b/src/debug.cc index a2b045fa05..7dca120f9b 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -1,5 +1,5 @@ /* - * $Id: debug.cc,v 1.18 1996/07/09 03:41:21 wessels Exp $ + * $Id: debug.cc,v 1.19 1996/07/18 20:27:00 wessels Exp $ * * DEBUG: section 0 Debug Routines * AUTHOR: Harvest Derived @@ -130,8 +130,8 @@ void _db_print(va_alist) int level; char *format = NULL; #endif - static char f[BUFSIZ]; - static char tmpbuf[BUFSIZ]; + LOCAL_ARRAY(char, f, BUFSIZ); + LOCAL_ARRAY(char, tmpbuf, BUFSIZ); char *s = NULL; if (debug_log == NULL) @@ -255,8 +255,8 @@ void _db_init(logfile, options) void _db_rotate_log() { int i; - static char from[MAXPATHLEN]; - static char to[MAXPATHLEN]; + LOCAL_ARRAY(char, from, MAXPATHLEN); + LOCAL_ARRAY(char, to, MAXPATHLEN); if (debug_log_file == NULL) return; diff --git a/src/disk.cc b/src/disk.cc index e2384d35ba..6dc267b054 100644 --- a/src/disk.cc +++ b/src/disk.cc @@ -1,5 +1,5 @@ /* - * $Id: disk.cc,v 1.19 1996/07/17 16:59:59 wessels Exp $ + * $Id: disk.cc,v 1.20 1996/07/18 20:27:00 wessels Exp $ * * DEBUG: section 6 Disk I/O Routines * AUTHOR: Harvest Derived @@ -519,7 +519,7 @@ int diskHandleWalk(fd, walk_dat) int end_pos; int st_pos; int used_bytes; - static char temp_line[DISK_LINE_LEN]; + LOCAL_ARRAY(char, temp_line, DISK_LINE_LEN); lseek(fd, walk_dat->offset, SEEK_SET); file_table[fd].at_eof = NO; diff --git a/src/ftp.cc b/src/ftp.cc index 1afa78343e..ff7c3d036e 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -1,5 +1,6 @@ + /* - * $Id: ftp.cc,v 1.42 1996/07/15 23:57:51 wessels Exp $ + * $Id: ftp.cc,v 1.43 1996/07/18 20:27:01 wessels Exp $ * * DEBUG: section 9 File Transfer Protocol (FTP) * AUTHOR: Harvest Derived @@ -305,7 +306,7 @@ int ftpReadReply(fd, data) int fd; FtpData *data; { - static char buf[SQUID_TCP_SO_RCVBUF]; + LOCAL_ARRAY(char, buf, SQUID_TCP_SO_RCVBUF); int len; int clen; int off; @@ -472,8 +473,8 @@ void ftpSendRequest(fd, data) char *path = NULL; char *mode = NULL; char *buf = NULL; - static char tbuf[BUFSIZ]; - static char opts[BUFSIZ]; + LOCAL_ARRAY(char, tbuf, BUFSIZ); + LOCAL_ARRAY(char, opts, BUFSIZ); static char *space = " "; char *s = NULL; int got_timeout = 0; @@ -592,7 +593,7 @@ int ftpStart(unusedfd, url, request, entry) request_t *request; StoreEntry *entry; { - static char realm[8192]; + LOCAL_ARRAY(char, realm, 8192); FtpData *data = NULL; char *req_hdr = entry->mem_obj->mime_hdr; char *auth_hdr; @@ -732,7 +733,7 @@ int ftpInitialize() int cfd; int squid_to_ftpget[2]; int ftpget_to_squid[2]; - static char pbuf[128]; + LOCAL_ARRAY(char, pbuf, 128); char *ftpget = getFtpProgram(); struct sockaddr_in S; int len; diff --git a/src/gopher.cc b/src/gopher.cc index ca3a47de74..44ebf033fe 100644 --- a/src/gopher.cc +++ b/src/gopher.cc @@ -1,5 +1,5 @@ /* - * $Id: gopher.cc,v 1.32 1996/07/15 23:14:27 wessels Exp $ + * $Id: gopher.cc,v 1.33 1996/07/18 20:27:01 wessels Exp $ * * DEBUG: section 10 Gopher * AUTHOR: Harvest Derived @@ -184,7 +184,7 @@ static void gopher_mime_content(buf, name, def) char *name; char *def; { - static char temp[MAX_URL + 1]; + LOCAL_ARRAY(char, temp, MAX_URL + 1); char *ext1 = NULL; char *ext2 = NULL; char *str = NULL; @@ -234,7 +234,7 @@ static void gopher_mime_content(buf, name, def) void gopherMimeCreate(data) GopherData *data; { - static char tempMIME[MAX_MIME]; + LOCAL_ARRAY(char, tempMIME, MAX_MIME); sprintf(tempMIME, "\ HTTP/1.0 200 OK Gatewaying\r\n\ @@ -289,8 +289,8 @@ int gopher_url_parser(url, host, port, type_id, request) char *type_id; char *request; { - static char proto[MAX_URL]; - static char hostbuf[MAX_URL]; + LOCAL_ARRAY(char, proto, MAX_URL); + LOCAL_ARRAY(char, hostbuf, MAX_URL); int t; proto[0] = hostbuf[0] = '\0'; @@ -355,7 +355,7 @@ int gopherCachable(url) void gopherEndHTML(data) GopherData *data; { - static char tmpbuf[TEMP_BUF_SIZE]; + LOCAL_ARRAY(char, tmpbuf, TEMP_BUF_SIZE); if (!data->data_in) { sprintf(tmpbuf, "

Server Return Nothing.

\n"); @@ -375,9 +375,9 @@ void gopherToHTML(data, inbuf, len) char *pos = inbuf; char *lpos = NULL; char *tline = NULL; - static char line[TEMP_BUF_SIZE]; - static char tmpbuf[TEMP_BUF_SIZE]; - static char outbuf[TEMP_BUF_SIZE << 4]; + LOCAL_ARRAY(char, line, TEMP_BUF_SIZE); + LOCAL_ARRAY(char, tmpbuf, TEMP_BUF_SIZE); + LOCAL_ARRAY(char, outbuf, TEMP_BUF_SIZE << 4); char *name = NULL; char *selector = NULL; char *host = NULL; @@ -593,7 +593,7 @@ void gopherToHTML(data, inbuf, len) int t; int code; int recno; - static char result[MAX_CSO_RESULT]; + LOCAL_ARRAY(char, result, MAX_CSO_RESULT); tline = line; @@ -908,7 +908,7 @@ void gopherSendRequest(fd, data) GopherData *data; { int len; - static char query[MAX_URL]; + LOCAL_ARRAY(char, query, MAX_URL); char *buf = get_free_4k_page(); data->icp_page_ptr = buf; diff --git a/src/http.cc b/src/http.cc index 43508a5c96..0f416b1217 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,5 +1,5 @@ /* - * $Id: http.cc,v 1.61 1996/07/15 23:15:16 wessels Exp $ + * $Id: http.cc,v 1.62 1996/07/18 20:27:02 wessels Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -400,7 +400,7 @@ static void httpReadReply(fd, httpState) int fd; HttpStateData *httpState; { - static char buf[SQUID_TCP_SO_RCVBUF]; + LOCAL_ARRAY(char, buf, SQUID_TCP_SO_RCVBUF); int len; int bin; int clen; diff --git a/src/ident.cc b/src/ident.cc index a2b45b652c..ec1c2bc1f1 100644 --- a/src/ident.cc +++ b/src/ident.cc @@ -1,5 +1,5 @@ /* - * $Id: ident.cc,v 1.4 1996/07/11 17:25:24 wessels Exp $ + * $Id: ident.cc,v 1.5 1996/07/18 20:27:04 wessels Exp $ * * DEBUG: section 31 Ident (RFC 931) * AUTHOR: Duane Wessels @@ -49,7 +49,7 @@ void identStart(sock, icpState) { char *host; u_short port; - static char reqbuf[BUFSIZ]; + LOCAL_ARRAY(char, reqbuf, BUFSIZ); int status; host = inet_ntoa(icpState->peer.sin_addr); @@ -104,7 +104,7 @@ static void identReadReply(fd, icpState) int fd; icpStateData *icpState; { - static char buf[BUFSIZ]; + LOCAL_ARRAY(char, buf, BUFSIZ); char *t = NULL; int len = -1; diff --git a/src/ipcache.cc b/src/ipcache.cc index 948c293163..7a3bc28242 100644 --- a/src/ipcache.cc +++ b/src/ipcache.cc @@ -1,5 +1,5 @@ /* - * $Id: ipcache.cc,v 1.32 1996/07/15 23:10:54 wessels Exp $ + * $Id: ipcache.cc,v 1.33 1996/07/18 20:27:04 wessels Exp $ * * DEBUG: section 14 IP Cache * AUTHOR: Harvest Derived @@ -1027,7 +1027,7 @@ void ipcacheOpenServers() char *prg = getDnsProgram(); int k; int dnssocket; - static char fd_note_buf[FD_ASCII_NOTE_SZ]; + LOCAL_ARRAY(char, fd_note_buf, FD_ASCII_NOTE_SZ); /* free old structures if present */ if (dns_child_table) { diff --git a/src/mime.cc b/src/mime.cc index 7c1335c4a5..5cfe2a5200 100644 --- a/src/mime.cc +++ b/src/mime.cc @@ -1,5 +1,5 @@ /* - * $Id: mime.cc,v 1.13 1996/07/09 03:41:33 wessels Exp $ + * $Id: mime.cc,v 1.14 1996/07/18 20:27:05 wessels Exp $ * * DEBUG: section 25 MIME Parsing * AUTHOR: Harvest Derived @@ -110,7 +110,7 @@ char *mime_get_header(char *mime, char *name) { - static char header[GET_HDR_SZ]; + LOCAL_ARRAY(char, header, GET_HDR_SZ); char *p = NULL; char *q = NULL; char got = 0; @@ -187,7 +187,7 @@ ext_table_entry *mime_ext_to_type(extension) int low; int high; int comp; - static char ext[16]; + LOCAL_ARRAY(char, ext, 16); char *cp = NULL; if (!extension || strlen(extension) >= (sizeof(ext) - 1)) @@ -229,10 +229,10 @@ int mk_mime_hdr(result, ttl, size, lmt, type) { time_t expiretime; time_t t; - static char date[100]; - static char expires[100]; - static char last_modified[100]; - static char content_length[100]; + LOCAL_ARRAY(char, date, 100); + LOCAL_ARRAY(char, expires, 100); + LOCAL_ARRAY(char, last_modified, 100); + LOCAL_ARRAY(char, content_length, 100); if (result == NULL) return 1; diff --git a/src/neighbors.cc b/src/neighbors.cc index 5f18141a8f..775d155dbb 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -1,5 +1,5 @@ /* - * $Id: neighbors.cc,v 1.30 1996/07/17 17:50:07 wessels Exp $ + * $Id: neighbors.cc,v 1.31 1996/07/18 20:27:06 wessels Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -173,7 +173,7 @@ void hierarchy_log_append(entry, code, timeout, cache_host) char *url = entry->url; MemObject *mem = entry->mem_obj; static time_t last_time = 0; - static char time_str[128]; + LOCAL_ARRAY(char, time_str, 128); char *s = NULL; if (!cache_hierarchy_log) @@ -500,7 +500,7 @@ int neighborsUdpPing(proto) mem->w_rtt = 0; mem->start_ping = current_time; - if (friends->edges_head == (edge *) NULL) + if (friends->edges_head == NULL) return 0; for (i = 0, e = friends->first_ping; i++ < friends->n; e = e->next) { @@ -510,7 +510,7 @@ int neighborsUdpPing(proto) /* Don't resolve refreshes through neighbors because we don't resolve * misses through neighbors */ - if (e->type == EDGE_SIBLING && entry->flag & REFRESH_REQUEST) + if (entry->flag & REFRESH_REQUEST && e->type == EDGE_SIBLING) continue; /* skip any cache where we failed to connect() w/in the last 60s */ @@ -535,9 +535,19 @@ int neighborsUdpPing(proto) if (e->icp_port == echo_port) { debug(15, 4, "neighborsUdpPing: Looks like a dumb cache, send DECHO ping\n"); - icpUdpSend(friends->fd, url, &echo_hdr, &e->in_addr, ICP_OP_DECHO, LOG_TAG_NONE); + icpUdpSend(friends->fd, + url, + &echo_hdr, + &e->in_addr, + ICP_OP_DECHO, + LOG_TAG_NONE); } else { - icpUdpSend(friends->fd, url, &e->header, &e->in_addr, ICP_OP_QUERY, LOG_TAG_NONE); + icpUdpSend(friends->fd, + url, + &e->header, + &e->in_addr, + ICP_OP_QUERY, + LOG_TAG_NONE); } e->stats.ack_deficit++; @@ -907,8 +917,8 @@ void neighbors_rotate_log() { char *fname = NULL; int i; - static char from[MAXPATHLEN]; - static char to[MAXPATHLEN]; + LOCAL_ARRAY(char, from, MAXPATHLEN); + LOCAL_ARRAY(char, to, MAXPATHLEN); if ((fname = getHierarchyLogFile()) == NULL) return; diff --git a/src/redirect.cc b/src/redirect.cc index de7014de58..575d0e3c2e 100644 --- a/src/redirect.cc +++ b/src/redirect.cc @@ -1,5 +1,5 @@ /* - * $Id: redirect.cc,v 1.4 1996/07/16 01:51:14 wessels Exp $ + * $Id: redirect.cc,v 1.5 1996/07/18 20:27:07 wessels Exp $ * * DEBUG: section 29 Redirector * AUTHOR: Duane Wessels @@ -310,7 +310,7 @@ void redirectOpenServers() char *prg = getRedirectProgram(); int k; int redirectsocket; - static char fd_note_buf[FD_ASCII_NOTE_SZ]; + LOCAL_ARRAY(char, fd_note_buf, FD_ASCII_NOTE_SZ); static int first_time = 0; if (!do_redirect) diff --git a/src/send-announce.cc b/src/send-announce.cc index 9434e8cec4..1ed664200b 100644 --- a/src/send-announce.cc +++ b/src/send-announce.cc @@ -1,6 +1,6 @@ /* - * $Id: send-announce.cc,v 1.14 1996/07/15 23:10:57 wessels Exp $ + * $Id: send-announce.cc,v 1.15 1996/07/18 20:27:08 wessels Exp $ * * DEBUG: section 27 Cache Announcer * AUTHOR: Duane Wessels @@ -33,8 +33,8 @@ void send_announce() { - static char tbuf[256]; - static char sndbuf[BUFSIZ]; + LOCAL_ARRAY(char, tbuf, 256); + LOCAL_ARRAY(char, sndbuf, BUFSIZ); icpUdpData *qdata = NULL; struct hostent *hp = NULL; char *host = NULL; diff --git a/src/squid.h b/src/squid.h index 4449658ace..d9e16d6a24 100644 --- a/src/squid.h +++ b/src/squid.h @@ -1,6 +1,6 @@ /* - * $Id: squid.h,v 1.27 1996/07/15 23:48:36 wessels Exp $ + * $Id: squid.h,v 1.28 1996/07/18 20:27:08 wessels Exp $ * * AUTHOR: Duane Wessels * @@ -199,6 +199,15 @@ typedef unsigned long u_num32; #endif #define NUM32LEN sizeof(num32) /* this should always be 4 */ +#if MALLOC_GUARD +#define LOCAL_ARRAY(type,name,size) \ + static type *local_##name=NULL; \ + type *name = local_##name ? local_##name : \ + ( local_##name = (type *)xcalloc(size, sizeof(type)) ) +#else +#define LOCAL_ARRAY(type,name,size) static type name[size] +#endif + #include "GNUregex.h" #include "ansihelp.h" diff --git a/src/ssl.cc b/src/ssl.cc index d48e7c5f0a..5f1a50b493 100644 --- a/src/ssl.cc +++ b/src/ssl.cc @@ -1,5 +1,6 @@ + /* - * $Id: ssl.cc,v 1.5 1996/07/11 17:42:53 wessels Exp $ + * $Id: ssl.cc,v 1.6 1996/07/18 20:27:09 wessels Exp $ * * DEBUG: section 26 Secure Sockets Layer Proxy * AUTHOR: Duane Wessels diff --git a/src/stat.cc b/src/stat.cc index 320c14c39d..3f51d70f9d 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -1,5 +1,5 @@ /* - * $Id: stat.cc,v 1.41 1996/07/17 17:03:20 wessels Exp $ + * $Id: stat.cc,v 1.42 1996/07/18 20:27:10 wessels Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -262,8 +262,8 @@ void stat_objects_get(obj, sentry, vm_or_not) StoreEntry *sentry; int vm_or_not; { - static char space[40]; - static char space2[40]; + LOCAL_ARRAY(char, space, 40); + LOCAL_ARRAY(char, space2, 40); int npend = 0; StoreEntry *entry = NULL; int N = 0; @@ -522,7 +522,7 @@ static char *host_port_fmt(host, port) char *host; u_short port; { - static char buf[32]; + LOCAL_ARRAY(char, buf, 32); sprintf(buf, "%s.%d", host, (int) port); return buf; } @@ -894,7 +894,7 @@ void log_append(obj, url, id, size, action, method, http_code, msec, ident, hier char *ident; hier_code hier; { - static char tmp[6000]; /* MAX_URL is 4096 */ + LOCAL_ARRAY(char, tmp, 6000); /* MAX_URL is 4096 */ char *buf = NULL; int x; @@ -1163,7 +1163,7 @@ void stat_init(object, logfilename) char *stat_describe(entry) StoreEntry *entry; { - static char state[256]; + LOCAL_ARRAY(char, state, 256); state[0] = '\0'; switch (entry->store_status) { @@ -1205,7 +1205,7 @@ char *stat_describe(entry) char *mem_describe(entry) StoreEntry *entry; { - static char where[100]; + LOCAL_ARRAY(char, where, 100); where[0] = '\0'; if (entry->swap_file_number >= 0) @@ -1231,7 +1231,7 @@ char *ttl_describe(entry) StoreEntry *entry; { int hh, mm, ss; - static char TTL[60]; + LOCAL_ARRAY(char, TTL, 60); int ttl; TTL[0] = '\0'; @@ -1281,7 +1281,7 @@ char *elapsed_time(entry, since, TTL) char *flags_describe(entry) StoreEntry *entry; { - static char FLAGS[32]; + LOCAL_ARRAY(char, FLAGS, 32); char LOCK_CNT[32]; strcpy(FLAGS, "F:"); @@ -1311,8 +1311,8 @@ char *flags_describe(entry) void stat_rotate_log() { int i; - static char from[MAXPATHLEN]; - static char to[MAXPATHLEN]; + LOCAL_ARRAY(char, from, MAXPATHLEN); + LOCAL_ARRAY(char, to, MAXPATHLEN); char *fname = NULL; if ((fname = CacheInfo->logfilename) == NULL) diff --git a/src/store.cc b/src/store.cc index 904415ddd0..ac2e562700 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1,5 +1,5 @@ /* - * $Id: store.cc,v 1.69 1996/07/17 17:10:00 wessels Exp $ + * $Id: store.cc,v 1.70 1996/07/18 20:27:10 wessels Exp $ * * DEBUG: section 20 Storeage Manager * AUTHOR: Harvest Derived @@ -387,7 +387,7 @@ void storeSetMemStatus(e, status) static char *time_describe(t) time_t t; { - static char buf[128]; + LOCAL_ARRAY(char, buf, 128); if (t < 60) { sprintf(buf, "%ds", (int) t); @@ -1024,7 +1024,7 @@ void storeAppend(e, data, len) void storeAppendPrintf(StoreEntry * e, char *fmt,...) { va_list args; - static char buf[4096]; + LOCAL_ARRAY(char, buf, 4096); va_start(args, fmt); #else void storeAppendPrintf(va_alist) @@ -1033,7 +1033,7 @@ void storeAppendPrintf(va_alist) va_list args; StoreEntry *e = NULL; char *fmt = NULL; - static char buf[4096]; + LOCAL_ARRAY(char, buf, 4096); va_start(args); e = va_arg(args, StoreEntry *); fmt = va_arg(args, char *); @@ -1069,7 +1069,7 @@ char *storeSwapFullPath(fn, fullpath) int fn; char *fullpath; { - static char fullfilename[MAX_FILE_NAME_LEN]; + LOCAL_ARRAY(char, fullfilename, MAX_FILE_NAME_LEN); if (fullpath) { sprintf(fullpath, "%s/%02d/%d", @@ -1209,7 +1209,7 @@ void storeSwapOutHandle(fd, flag, e) int flag; StoreEntry *e; { - static char filename[MAX_FILE_NAME_LEN]; + LOCAL_ARRAY(char, filename, MAX_FILE_NAME_LEN); MemObject *mem = e->mem_obj; debug(20, 3, "storeSwapOutHandle: '%s'\n", e->key); @@ -1306,7 +1306,7 @@ static int storeSwapOutStart(e) StoreEntry *e; { int fd; - static char swapfilename[MAX_FILE_NAME_LEN]; + LOCAL_ARRAY(char, swapfilename, MAX_FILE_NAME_LEN); int x; MemObject *mem = e->mem_obj; /* Suggest a new swap file number */ @@ -1361,9 +1361,9 @@ static int storeSwapOutStart(e) static int storeDoRebuildFromDisk(data) struct storeRebuild_data *data; { - static char log_swapfile[MAXPATHLEN]; - static char swapfile[MAXPATHLEN]; - static char url[MAX_URL + 1]; + LOCAL_ARRAY(char, log_swapfile, MAXPATHLEN); + LOCAL_ARRAY(char, swapfile, MAXPATHLEN); + LOCAL_ARRAY(char, url, MAX_URL + 1); char *t = NULL; StoreEntry *e = NULL; time_t expires; @@ -1682,8 +1682,8 @@ int storeAbort(e, msg) StoreEntry *e; char *msg; { - static char mime_hdr[300]; - static char abort_msg[2000]; + LOCAL_ARRAY(char, mime_hdr, 300); + LOCAL_ARRAY(char, abort_msg, 2000); debug(20, 6, "storeAbort: '%s'\n", e->key); e->expires = squid_curtime + getNegativeTTL(); @@ -2598,7 +2598,7 @@ static int storeVerifySwapDirs(clean) static void storeCreateSwapSubDirs() { int i, j; - static char name[MAXPATHLEN]; + LOCAL_ARRAY(char, name, MAXPATHLEN); for (j = 0; j < ncache_dirs; j++) { for (i = 0; i < SWAP_DIRECTORIES; i++) { sprintf(name, "%s/%02d", swappath(j), i); @@ -2680,7 +2680,7 @@ int storeInit() */ void storeSanityCheck() { - static char name[4096]; + LOCAL_ARRAY(char, name, 4096); int i; if (ncache_dirs < 1) @@ -2772,7 +2772,7 @@ int storeMaintainSwapSpace() int storeWriteCleanLog() { StoreEntry *e = NULL; - static char swapfilename[MAX_FILE_NAME_LEN]; + LOCAL_ARRAY(char, swapfilename, MAX_FILE_NAME_LEN); FILE *fp = NULL; int n = 0; int x = 0; @@ -2877,8 +2877,8 @@ void storeRotateLog() { char *fname = NULL; int i; - static char from[MAXPATHLEN]; - static char to[MAXPATHLEN]; + LOCAL_ARRAY(char, from, MAXPATHLEN); + LOCAL_ARRAY(char, to, MAXPATHLEN); if (storelog_fd > -1) { file_close(storelog_fd); diff --git a/src/tools.cc b/src/tools.cc index 94939d5ecb..b55cdc0422 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -1,6 +1,6 @@ /* - * $Id: tools.cc,v 1.44 1996/07/15 23:48:38 wessels Exp $ + * $Id: tools.cc,v 1.45 1996/07/18 20:27:12 wessels Exp $ * * DEBUG: section 21 Misc Functions * AUTHOR: Harvest Derived @@ -122,7 +122,7 @@ Thanks!\n" static char *dead_msg() { - static char msg[1024]; + LOCAL_ARRAY(char, msg, 1024); sprintf(msg, DEAD_MSG, version_string, version_string); return msg; } @@ -130,8 +130,8 @@ static char *dead_msg() void mail_warranty() { FILE *fp = NULL; - static char filename[256]; - static char command[256]; + LOCAL_ARRAY(char, filename, 256); + LOCAL_ARRAY(char, command, 256); sprintf(filename, "/tmp/mailin%d", (int) getpid()); fp = fopen(filename, "w"); @@ -359,7 +359,7 @@ void sig_child(sig) char *getMyHostname() { - static char host[SQUIDHOSTNAMELEN + 1]; + LOCAL_ARRAY(char, host, SQUIDHOSTNAMELEN + 1); static int present = 0; struct hostent *h = NULL; char *t = NULL; diff --git a/src/tunnel.cc b/src/tunnel.cc index d8d4853583..f6d04bb0d8 100644 --- a/src/tunnel.cc +++ b/src/tunnel.cc @@ -1,5 +1,6 @@ + /* - * $Id: tunnel.cc,v 1.5 1996/07/11 17:42:53 wessels Exp $ + * $Id: tunnel.cc,v 1.6 1996/07/18 20:27:09 wessels Exp $ * * DEBUG: section 26 Secure Sockets Layer Proxy * AUTHOR: Duane Wessels diff --git a/src/url.cc b/src/url.cc index dc6c9a6de7..7473e7f872 100644 --- a/src/url.cc +++ b/src/url.cc @@ -1,5 +1,5 @@ /* - * $Id: url.cc,v 1.23 1996/07/15 23:13:34 wessels Exp $ + * $Id: url.cc,v 1.24 1996/07/18 20:27:12 wessels Exp $ * * DEBUG: section 23 URL Parsing * AUTHOR: Duane Wessels @@ -188,10 +188,10 @@ request_t *urlParse(method, url) method_t method; char *url; { - static char proto[MAX_URL + 1]; - static char login[MAX_URL + 1]; - static char host[MAX_URL + 1]; - static char urlpath[MAX_URL + 1]; + LOCAL_ARRAY(char, proto, MAX_URL + 1); + LOCAL_ARRAY(char, login, MAX_URL + 1); + LOCAL_ARRAY(char, host, MAX_URL + 1); + LOCAL_ARRAY(char, urlpath, MAX_URL + 1); request_t *request = NULL; char *t = NULL; int port; @@ -240,8 +240,8 @@ char *urlCanonical(request, buf) request_t *request; char *buf; { - static char urlbuf[MAX_URL + 1]; - static char portbuf[32]; + LOCAL_ARRAY(char, urlbuf, MAX_URL + 1); + LOCAL_ARRAY(char, portbuf, 32); if (buf == NULL) buf = urlbuf; switch (request->method) { diff --git a/src/wais.cc b/src/wais.cc index 74d9f02e8b..7bf85b4b83 100644 --- a/src/wais.cc +++ b/src/wais.cc @@ -1,5 +1,5 @@ /* - * $Id: wais.cc,v 1.32 1996/07/15 23:14:28 wessels Exp $ + * $Id: wais.cc,v 1.33 1996/07/18 20:27:13 wessels Exp $ * * DEBUG: section 24 WAIS Relay * AUTHOR: Harvest Derived @@ -174,7 +174,7 @@ static void waisReadReply(fd, waisState) int fd; WaisStateData *waisState; { - static char buf[4096]; + LOCAL_ARRAY(char, buf, 4096); int len; StoreEntry *entry = NULL;