dgaudet 97/09/17 17:20:25
Modified:src/modules/proxy proxy_cache.c proxy_ftp.c proxy_http.c
proxy_util.c
Log:
mod_proxy uses char *p and pool *pool a whole bunch ... which is not
exactly the style we use elsewhere in the code. Clean this up.
I'm not sure, but proxy_cache.c had some interesting -Wshadow warnings
involving a global time_t now and local time_t nows... I changed the
name of the global to garbage_now.
Other similar fixes. This is just syntactic sugar similar to the indent
changes. I avoided fixing obvious segfault bugs I saw while doing this.
The entire server should now pass gcc -Wshadow, which makes me a bit
happier.
Revision ChangesPath
1.28 +13 -13apachen/src/modules/proxy/proxy_cache.c
Index: proxy_cache.c
===
RCS file: /export/home/cvs/apachen/src/modules/proxy/proxy_cache.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- proxy_cache.c 1997/09/16 00:59:39 1.27
+++ proxy_cache.c 1997/09/18 00:20:18 1.28
@@ -90,7 +90,7 @@
static int curbytes, cachesize, every;
static unsigned long int curblocks;
-static time_t now, expire;
+static time_t garbage_now, garbage_expire;
static char *filename;
static mutex *garbage_mutex = NULL;
@@ -148,8 +148,8 @@
if (cachedir == NULL || every == -1)
return;
-now = time(NULL);
-if (now != -1 lastcheck != BAD_DATE now lastcheck + every)
+garbage_now = time(NULL);
+if (garbage_now != -1 lastcheck != BAD_DATE garbage_now
lastcheck + every)
return;
block_alarms(); /* avoid SIGALRM on big cache cleanup */
@@ -167,7 +167,7 @@
if (errno != EEXIST)
proxy_log_uerror(creat, filename, NULL, r-server);
else
- lastcheck = abs(now); /* someone else got in there */
+ lastcheck = abs(garbage_now); /* someone else got in there */
unblock_alarms();
return;
}
@@ -175,7 +175,7 @@
}
else {
lastcheck = buf.st_mtime; /* save the time */
- if (now lastcheck + every) {
+ if (garbage_now lastcheck + every) {
unblock_alarms();
return;
}
@@ -199,7 +199,7 @@
for (i = 0; i files-nelts; i++) {
fent = elts[i];
sprintf(filename, %s%s, cachedir, fent-file);
- Explain3(GC Unlinking %s (expiry %ld, now %ld), filename,
fent-expire, now);
+ Explain3(GC Unlinking %s (expiry %ld, garbage_now %ld), filename,
fent-garbage_expire, garbage_now);
#if TESTING
fprintf(stderr, Would unlink %s\n, filename);
#else
@@ -259,8 +259,8 @@
if (errno != ENOENT)
proxy_log_uerror(stat, filename, NULL, r-server);
}
- else if (now != -1 buf.st_atime now - SEC_ONE_DAY
- buf.st_mtime now - SEC_ONE_DAY) {
+ else if (garbage_now != -1 buf.st_atime garbage_now -
SEC_ONE_DAY
+ buf.st_mtime garbage_now - SEC_ONE_DAY) {
Explain1(GC unlink %s, filename);
#if TESTING
fprintf(stderr, Would unlink %s\n, filename);
@@ -314,12 +314,12 @@
}
close(fd);
line[i] = '\0';
- expire = proxy_hex2sec(line + 18);
+ garbage_expire = proxy_hex2sec(line + 18);
if (!checkmask(line, ) ||
- expire == BAD_DATE) {
+ garbage_expire == BAD_DATE) {
/* bad file */
- if (now != -1 buf.st_atime now + SEC_ONE_DAY
- buf.st_mtime now + SEC_ONE_DAY) {
+ if (garbage_now != -1 buf.st_atime garbage_now + SEC_ONE_DAY
+ buf.st_mtime garbage_now + SEC_ONE_DAY) {
log_error(proxy: deleting bad cache file, r-server);
#if TESTING
fprintf(stderr, Would unlink bad file %s\n, filename);
@@ -340,7 +340,7 @@
*/
fent = palloc(r-pool, sizeof(struct gc_ent));
fent-len = buf.st_size;
- fent-expire = expire;
+ fent-expire = garbage_expire;
strcpy(fent-file, cachesubdir);
strcat(fent-file, ent-d_name);
*(struct gc_ent **) push_array(files) = fent;
1.39 +58 -59apachen/src/modules/proxy/proxy_ftp.c
Index: proxy_ftp.c
===
RCS file: /export/home/cvs/apachen/src/modules/proxy/proxy_ftp.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- proxy_ftp.c 1997/09/16 00:59:40 1.38
+++ proxy_ftp.c 1997/09/18 00:20:19 1.39
@@ -105,13 +105,13 @@
*/
int proxy_ftp_canon(request_rec *r, char *url)
{
-char *user, *password, *host, *path, *parms, *p, sport[7];
-pool *pool = r-pool;
+char *user,