You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Dean Gaudet <dg...@arctic.org> on 1997/12/21 01:08:05 UTC

[PATCH] util_date.c needless reinitialization

These arrays are never changed, initialize them at compile time for
tighter code. 

Dean

Index: util_date.c
===================================================================
RCS file: /export/home/cvs/apachen/src/main/util_date.c,v
retrieving revision 1.6
diff -u -r1.6 util_date.c
--- util_date.c	1997/10/22 20:29:51	1.6
+++ util_date.c	1997/12/20 23:57:27
@@ -136,7 +136,7 @@
 {
     int year;
     time_t days;
-    const int dayoffset[12] =
+    static const int dayoffset[12] =
     {306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275};
 
     year = t->tm_year;
@@ -215,7 +215,7 @@
     struct tm ds;
     int mint, mon;
     const char *monstr, *timstr;
-    const int months[12] =
+    static const int months[12] =
     {
 	('J' << 16) | ('a' << 8) | 'n', ('F' << 16) | ('e' << 8) | 'b',
 	('M' << 16) | ('a' << 8) | 'r', ('A' << 16) | ('p' << 8) | 'r',


Re: [PATCH] util_date.c needless reinitialization

Posted by Martin Kraemer <Ma...@mch.sni.de>.
On Sat, Dec 20, 1997 at 04:08:05PM -0800, Dean Gaudet wrote:
> These arrays are never changed, initialize them at compile time for
> tighter code. 
+1
    Martin
-- 
| S I E M E N S |  <Ma...@mch.sni.de>  |      Siemens Nixdorf
| ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
| N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request