make some arrays const
authorrofl0r <retnyg@gmx.net>
Sat, 2 Feb 2013 02:08:57 +0000 (03:08 +0100)
committerrofl0r <retnyg@gmx.net>
Sat, 2 Feb 2013 02:19:25 +0000 (03:19 +0100)
this way they'll go into .rodata, decreasing memory pressure.

src/crypt/crypt_md5.c
src/crypt/crypt_sha256.c
src/crypt/crypt_sha512.c
src/ctype/iswalpha.c
src/ctype/iswpunct.c
src/ctype/wcwidth.c
src/time/__tm_to_time.c

index 70ab8b9..6e75b36 100644 (file)
@@ -182,7 +182,7 @@ static void md5_update(struct md5 *s, const void *m, unsigned long len)
 #define KEY_MAX 30000
 #define SALT_MAX 8
 
-static unsigned char b64[] =
+static const unsigned char b64[] =
 "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
 
 static char *to64(char *s, unsigned int u, int n)
index e01a208..d5f0b78 100644 (file)
@@ -153,7 +153,7 @@ static void sha256_update(struct sha256 *s, const void *m, unsigned long len)
        memcpy(s->buf, p, len);
 }
 
-static unsigned char b64[] =
+static const unsigned char b64[] =
 "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
 
 static char *to64(char *s, unsigned int u, int n)
index 8325d77..1294e98 100644 (file)
@@ -174,7 +174,7 @@ static void sha512_update(struct sha512 *s, const void *m, unsigned long len)
        memcpy(s->buf, p, len);
 }
 
-static unsigned char b64[] =
+static const unsigned char b64[] =
 "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
 
 static char *to64(char *s, unsigned int u, int n)
index 4007c8a..d558fae 100644 (file)
@@ -1,6 +1,6 @@
 #include <wctype.h>
 
-static unsigned char table[] = {
+static const unsigned char table[] = {
 #include "alpha.h"
 };
 
index a829745..16e8703 100644 (file)
@@ -1,6 +1,6 @@
 #include <wctype.h>
 
-static unsigned char table[] = {
+static const unsigned char table[] = {
 #include "punct.h"
 };
 
index 98f128e..49c40ee 100644 (file)
@@ -1,10 +1,10 @@
 #include <wchar.h>
 
-static unsigned char table[] = {
+static const unsigned char table[] = {
 #include "nonspacing.h"
 };
 
-static unsigned char wtable[] = {
+static const unsigned char wtable[] = {
 #include "wide.h"
 };
 
index 3b1140b..9f11805 100644 (file)
@@ -26,7 +26,7 @@ time_t __tm_to_time(struct tm *tm)
        z100 = Q(z4, 25);
        z400 = Q(z100, 4);
        day += year*365 + z4 - z100 + z400 +
-               month[(int []){0,31,59,90,120,151,181,212,243,273,304,334}];
+               month[(const int []){0,31,59,90,120,151,181,212,243,273,304,334}];
        return (long long)day*86400
                + tm->tm_hour*3600 + tm->tm_min*60 + tm->tm_sec
                - -946684800; /* the dawn of time :) */