Hi, Attached is a trivial patch to liberally add the "const" keyword, and change char* into char[], to reduce the number of startup relocations performed by camel. Ross -- Ross Burton mail: ross burtonini com jabber: ross burtonini com www: http://www.burtonini.com./ PGP Fingerprint: 1A21 F5B0 D8D0 CFE3 81D4 E25A 2D09 E447 D0B4 33DF
Index: camel/broken-date-parser.c =================================================================== RCS file: /cvs/gnome/evolution-data-server/camel/broken-date-parser.c,v retrieving revision 1.14 diff -u -r1.14 broken-date-parser.c --- camel/broken-date-parser.c 2 Dec 2004 08:03:29 -0000 1.14 +++ camel/broken-date-parser.c 22 Apr 2005 16:04:31 -0000 @@ -54,7 +54,7 @@ #define DATE_TOKEN_NON_TIMEZONE_NUMERIC (1 << 6) #define DATE_TOKEN_HAS_SIGN (1 << 7) -static unsigned char datetok_table[256] = { +static const unsigned char datetok_table[256] = { 128,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111, 111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111, 111,111,111,111,111,111,111,111, 79, 79,111,175,111,175,111,111, @@ -74,8 +74,8 @@ }; /* hrm, is there a library for this shit? */ -static struct { - char *name; +static const struct { + char name[4]; int offset; } tz_offsets [] = { { "UT", 0 }, @@ -95,12 +95,12 @@ { "Y", 1200 }, }; -static char *tm_months[] = { +static const char tm_months[][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; -static char *tm_days[] = { +static const char tm_days[][4] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; @@ -506,7 +506,7 @@ datetok_table[i] |= DATE_TOKEN_HAS_SIGN; } - printf ("static unsigned int datetok_table[256] = {"); + printf ("static const unsigned int datetok_table[256] = {"); for (i = 0; i < 256; i++) { if (i % 16 == 0) printf ("\n\t"); Index: camel/camel-block-file.c =================================================================== RCS file: /cvs/gnome/evolution-data-server/camel/camel-block-file.c,v retrieving revision 1.16 diff -u -r1.16 camel-block-file.c --- camel/camel-block-file.c 2 Dec 2004 08:03:29 -0000 1.16 +++ camel/camel-block-file.c 22 Apr 2005 16:04:31 -0000 @@ -810,7 +810,7 @@ static EDList key_file_list = E_DLIST_INITIALISER(key_file_list); static EDList key_file_active_list = E_DLIST_INITIALISER(key_file_active_list); static int key_file_count = 0; -static int key_file_threshhold = 10; +static const int key_file_threshhold = 10; static void camel_key_file_class_init(CamelKeyFileClass *klass) Index: camel/camel-charset-map-private.h =================================================================== RCS file: /cvs/gnome/evolution-data-server/camel/camel-charset-map-private.h,v retrieving revision 1.5 diff -u -r1.5 camel-charset-map-private.h --- camel/camel-charset-map-private.h 7 Jan 2002 20:29:37 -0000 1.5 +++ camel/camel-charset-map-private.h 22 Apr 2005 16:04:31 -0000 @@ -1,6 +1,6 @@ /* This file is automatically generated: DO NOT EDIT */ -static unsigned char m000[256] = { +static const unsigned char m000[256] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, @@ -35,7 +35,7 @@ 0x82, 0x80, 0x83, 0x82, 0x83, 0x01, 0x00, 0x80, }; -static unsigned char m001[256] = { +static const unsigned char m001[256] = { 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, @@ -70,7 +70,7 @@ 0x03, 0x02, 0x02, 0x02, 0x03, 0x02, 0x02, 0x02, }; -static unsigned char m010[256] = { +static const unsigned char m010[256] = { 0x02, 0x02, 0x01, 0x01, 0x03, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x01, 0x01, 0x03, 0x03, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, @@ -105,7 +105,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -static unsigned char m011[256] = { +static const unsigned char m011[256] = { 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, @@ -140,7 +140,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -static unsigned char m020[256] = { +static const unsigned char m020[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -175,7 +175,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -static unsigned char m030[256] = { +static const unsigned char m030[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -210,7 +210,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -static unsigned char m040[256] = { +static const unsigned char m040[256] = { 0x00, 0x1c, 0x10, 0x10, 0x18, 0x10, 0x18, 0x18, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, @@ -245,7 +245,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -static unsigned char m041[256] = { +static const unsigned char m041[256] = { 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, @@ -280,7 +280,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -static unsigned char m050[256] = { +static const unsigned char m050[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -315,7 +315,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -static unsigned char m200[256] = { +static const unsigned char m200[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x40, @@ -350,7 +350,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -static unsigned char m201[256] = { +static const unsigned char m201[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x00, @@ -385,7 +385,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -static unsigned char m210[256] = { +static const unsigned char m210[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, @@ -420,7 +420,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -static unsigned char m211[256] = { +static const unsigned char m211[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, @@ -455,7 +455,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -static unsigned char m220[256] = { +static const unsigned char m220[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -490,7 +490,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -static unsigned char m230[256] = { +static const unsigned char m230[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -525,7 +525,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -static unsigned char m250[256] = { +static const unsigned char m250[256] = { 0x0c, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, @@ -561,8 +561,8 @@ }; struct { - unsigned char *bits0; - unsigned char *bits1; + const unsigned char *bits0; + const unsigned char *bits1; } camel_charmap[256] = { { m000, m001, }, { m010, m011, }, { m020, 0, }, { m030, 0, }, { m040, m041, }, { m050, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, @@ -598,7 +598,7 @@ { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, }; -struct { +const struct { const char *name; unsigned int bit; } camel_charinfo[] = { Index: camel/camel-mime-message.c =================================================================== RCS file: /cvs/gnome/evolution-data-server/camel/camel-mime-message.c,v retrieving revision 1.132 diff -u -r1.132 camel-mime-message.c --- camel/camel-mime-message.c 2 Mar 2005 02:56:20 -0000 1.132 +++ camel/camel-mime-message.c 22 Apr 2005 16:04:31 -0000 @@ -904,12 +904,12 @@ return check.part; } -static char *tz_months[] = { +static const char tz_months[][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; -static char *tz_days[] = { +static const char tz_days[][4] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; Index: camel/camel-mime-utils.c =================================================================== RCS file: /cvs/gnome/evolution-data-server/camel/camel-mime-utils.c,v retrieving revision 1.228 diff -u -r1.228 camel-mime-utils.c --- camel/camel-mime-utils.c 14 Apr 2005 20:10:20 -0000 1.228 +++ camel/camel-mime-utils.c 22 Apr 2005 16:04:32 -0000 @@ -74,15 +74,15 @@ #define CAMEL_UUENCODE_CHAR(c) ((c) ? (c) + ' ' : '`') #define CAMEL_UUDECODE_CHAR(c) (((c) - ' ') & 077) -static char *base64_alphabet = +static const char base64_alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -static unsigned char tohex[16] = { +static const unsigned char tohex[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; -static unsigned char camel_mime_base64_rank[256] = { +static const unsigned char camel_mime_base64_rank[256] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, @@ -3272,8 +3272,8 @@ } /* hrm, is there a library for this shit? */ -static struct { - char *name; +static const struct { + char name[4]; int offset; } tz_offsets [] = { { "UT", 0 }, @@ -3293,12 +3293,12 @@ { "Y", 1200 }, }; -static char *tz_months [] = { +static const char tz_months [][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; -static char *tz_days [] = { +static const char tz_days [][4] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; Index: camel/camel-object.c =================================================================== RCS file: /cvs/gnome/evolution-data-server/camel/camel-object.c,v retrieving revision 1.52 diff -u -r1.52 camel-object.c --- camel/camel-object.c 23 Dec 2004 04:22:43 -0000 1.52 +++ camel/camel-object.c 22 Apr 2005 16:04:33 -0000 @@ -105,18 +105,18 @@ }; /* used to tag a bag hookpair */ -static const char *bag_name = "object:bag"; +static const char bag_name[] = "object:bag\0"; /* meta-data stuff */ static void co_metadata_free(CamelObject *obj, CamelObjectMeta *meta); static CamelObjectMeta *co_metadata_get(CamelObject *obj); static CamelHookPair *co_metadata_pair(CamelObject *obj, int create); -static const char *meta_name = "object:meta"; +static const char meta_name[] = "object:meta\0"; #define CAMEL_OBJECT_STATE_FILE_MAGIC "CLMD" /* interface stuff */ -static const char *interface_name = "object:interface"; +static const char interface_name[] = "object:interface\0"; /* ********************************************************************** */ Index: camel/camel-url-scanner.c =================================================================== RCS file: /cvs/gnome/evolution-data-server/camel/camel-url-scanner.c,v retrieving revision 1.16 diff -u -r1.16 camel-url-scanner.c --- camel/camel-url-scanner.c 19 Apr 2005 15:05:41 -0000 1.16 +++ camel/camel-url-scanner.c 22 Apr 2005 16:04:33 -0000 @@ -149,9 +149,9 @@ #define is_urlsafe(x) ((url_scanner_table[(unsigned char)(x)] & (IS_ALPHA|IS_DIGIT|IS_URLSAFE)) != 0) -static struct { - char open; - char close; +static const struct { + const char open; + const char close; } url_braces[] = { { '(', ')' }, { '{', '}' }, Index: camel/camel-utf8.c =================================================================== RCS file: /cvs/gnome/evolution-data-server/camel/camel-utf8.c,v retrieving revision 1.6 diff -u -r1.6 camel-utf8.c --- camel/camel-utf8.c 5 Jan 2004 20:55:29 -0000 1.6 +++ camel/camel-utf8.c 22 Apr 2005 16:04:33 -0000 @@ -181,10 +181,10 @@ g_string_append(out, buffer); } -static char *utf7_alphabet = +static const char utf7_alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+,"; -static unsigned char utf7_rank[256] = { +static const unsigned char utf7_rank[256] = { 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3e,0x3f,0xff,0xff,0xff, Index: camel/gentables.pl =================================================================== RCS file: /cvs/gnome/evolution-data-server/camel/gentables.pl,v retrieving revision 1.1 diff -u -r1.1 gentables.pl --- camel/gentables.pl 20 Dec 2004 15:16:42 -0000 1.1 +++ camel/gentables.pl 22 Apr 2005 16:04:33 -0000 @@ -90,7 +90,7 @@ #header_init_bits(CAMEL_MIME_IS_PSAFE, 0, 0, CHARS_PSPECIAL); # output -print "unsigned short camel_mime_special_table[256] = {\n\t"; +print "const unsigned short camel_mime_special_table[256] = {\n\t"; foreach $i (0..255) { printf "0x%04x,", $table[$i]; if (($i & 0x7) == 0x7) {
Attachment:
signature.asc
Description: This is a digitally signed message part