dgaudet 98/03/04 01:45:47
Modified: src/include httpd.h src/main util.c src/modules/proxy proxy_util.c src/modules/standard mod_usertrack.c Log: As long as we're exporting month_snames we might as well make use of it. And if we're going to do that it seems silly not to export day_snames and make use of that. Revision Changes Path 1.191 +1 -0 apache-1.3/src/include/httpd.h Index: httpd.h =================================================================== RCS file: /export/home/cvs/apache-1.3/src/include/httpd.h,v retrieving revision 1.190 retrieving revision 1.191 diff -u -r1.190 -r1.191 --- httpd.h 1998/03/04 02:28:13 1.190 +++ httpd.h 1998/03/04 09:45:35 1.191 @@ -801,6 +801,7 @@ /* Time */ extern MODULE_VAR_EXPORT const char month_snames[12][4]; +extern MODULE_VAR_EXPORT const char day_snames[7][4]; API_EXPORT(struct tm *) get_gmtoff(int *tz); API_EXPORT(char *) get_time(void); 1.96 +5 -3 apache-1.3/src/main/util.c Index: util.c =================================================================== RCS file: /export/home/cvs/apache-1.3/src/main/util.c,v retrieving revision 1.95 retrieving revision 1.96 diff -u -r1.95 -r1.96 --- util.c 1998/03/04 09:35:45 1.95 +++ util.c 1998/03/04 09:45:38 1.96 @@ -79,6 +79,10 @@ { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; +const char day_snames[7][4] = +{ + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" +}; API_EXPORT(char *) get_time() { @@ -106,8 +110,6 @@ API_EXPORT(char *) gm_timestr_822(pool *p, time_t sec) { - static const char *const days[7] = - {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; char ts[50]; struct tm *tms; @@ -115,7 +117,7 @@ /* RFC date format; as strftime '%a, %d %b %Y %T GMT' */ ap_snprintf(ts, sizeof(ts), - "%s, %.2d %s %d %.2d:%.2d:%.2d GMT", days[tms->tm_wday], + "%s, %.2d %s %d %.2d:%.2d:%.2d GMT", day_snames[tms->tm_wday], tms->tm_mday, month_snames[tms->tm_mon], tms->tm_year + 1900, tms->tm_hour, tms->tm_min, tms->tm_sec); 1.48 +5 -10 apache-1.3/src/modules/proxy/proxy_util.c Index: proxy_util.c =================================================================== RCS file: /export/home/cvs/apache-1.3/src/modules/proxy/proxy_util.c,v retrieving revision 1.47 retrieving revision 1.48 diff -u -r1.47 -r1.48 --- proxy_util.c 1998/03/02 06:51:16 1.47 +++ proxy_util.c 1998/03/04 09:45:42 1.48 @@ -275,13 +275,8 @@ return NULL; } -static const char *lwday[7] = +static const char * const lwday[7] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; -static const char *wday[7] = -{"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; -static const char *months[12] = -{"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", - "Dec"}; /* * If the date is a valid RFC 850 date or asctime() date, then it @@ -326,7 +321,7 @@ &min, &sec, &year) != 7) return x; for (wk = 0; wk < 7; wk++) - if (strcmp(week, wday[wk]) == 0) + if (strcmp(week, day_snames[wk]) == 0) break; if (wk == 7) return x; @@ -334,15 +329,15 @@ /* check date */ for (mon = 0; mon < 12; mon++) - if (strcmp(month, months[mon]) == 0) + if (strcmp(month, month_snames[mon]) == 0) break; if (mon == 12) return x; if (strlen(x) < 30) x = palloc(p, 30); - ap_snprintf(x, 30, "%s, %.2d %s %d %.2d:%.2d:%.2d GMT", wday[wk], mday, - months[mon], year, hour, min, sec); + ap_snprintf(x, 30, "%s, %.2d %s %d %.2d:%.2d:%.2d GMT", day_snames[wk], mday, + month_snames[mon], year, hour, min, sec); return x; } 1.26 +2 -8 apache-1.3/src/modules/standard/mod_usertrack.c Index: mod_usertrack.c =================================================================== RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_usertrack.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- mod_usertrack.c 1998/01/26 19:50:26 1.25 +++ mod_usertrack.c 1998/03/04 09:45:46 1.26 @@ -109,10 +109,6 @@ time_t expires; } cookie_log_state; -static const char month_names[12][4] = { - "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" -}; - /* Define this to allow post-2000 cookies. Cookies use two-digit dates, * so it might be dicey. (Netscape does it correctly, but others may not) */ @@ -172,8 +168,6 @@ #endif if (cls->expires) { - static const char *const days[7] = - {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; struct tm *tms; time_t when = r->request_time + cls->expires; @@ -192,8 +186,8 @@ /* Cookie with date; as strftime '%a, %d-%h-%y %H:%M:%S GMT' */ ap_snprintf(new_cookie, 1024, "%s%s; path=/; expires=%s, %.2d-%s-%.2d %.2d:%.2d:%.2d GMT", - COOKIE_NAME, cookiebuf, days[tms->tm_wday], - tms->tm_mday, month_names[tms->tm_mon], + COOKIE_NAME, cookiebuf, day_snames[tms->tm_wday], + tms->tm_mday, month_snames[tms->tm_mon], tms->tm_year % 100, tms->tm_hour, tms->tm_min, tms->tm_sec); }