]> pd.if.org Git - pdclib.old/commitdiff
PDCLIB-25 #resolve #comment Made ctype, wctype and codec data const.(This may be...
authorOwen Shepherd <owen.shepherd@e43.eu>
Tue, 30 Apr 2013 21:16:55 +0000 (22:16 +0100)
committerOwen Shepherd <owen.shepherd@e43.eu>
Tue, 30 Apr 2013 21:16:55 +0000 (22:16 +0100)
functions/locale/UnicodeData.py
internals/_PDCLIB_locale.h
opt/basecodecs/_PDCLIB_ascii.c
opt/basecodecs/_PDCLIB_latin1.c
opt/basecodecs/_PDCLIB_utf8.c
platform/posix/functions/_PDCLIB/_PDCLIB_stdinit.c
platform/win32/functions/_PDCLIB/_PDCLIB_stdinit.c

index 7de35bdcb2592e20bab7ae229dd3cb66599fe87a..eb0f3c33137f249a71b6b2cd70b2fff480b5257e 100644 (file)
@@ -109,7 +109,7 @@ try:
  #ifndef REGTEST\r
  #include <_PDCLIB_locale.h>\r
 \r
- _PDCLIB_wcinfo_t _PDCLIB_wcinfo[] = {\r
+const _PDCLIB_wcinfo_t _PDCLIB_wcinfo[] = {\r
 //   { value,\tflags,\tlower,\tupper\t}, // name\r
  """)\r
     for line in in_file:\r
@@ -129,7 +129,7 @@ try:
             num, bits, lower_case, upper_case, name))\r
     out_file.write('};\n\n')\r
     out_file.write("""\r
-size_t _PDCLIB_wcinfo_size = sizeof(_PDCLIB_wcinfo) / sizeof(_PDCLIB_wcinfo[0]);\r
+const size_t _PDCLIB_wcinfo_size = sizeof(_PDCLIB_wcinfo) / sizeof(_PDCLIB_wcinfo[0]);\r
 #endif\r
 \r
 #ifdef TEST\r
index fd47c9ab0c4b537835d374536d20d15e9b0a70e1..861b486c032969735f14276b1473ce36faaa3872 100644 (file)
@@ -80,13 +80,14 @@ typedef struct _PDCLIB_wcinfo
 } _PDCLIB_wcinfo_t;
 
 struct _PDCLIB_locale {
-    _PDCLIB_charcodec_t          _Codec;
+    const _PDCLIB_charcodec_t    _Codec;
     struct lconv                 _Conv;
 
     /* ctype / wctype */
-    _PDCLIB_wcinfo_t            *_WCType;
+    /* XXX: Maybe re-evaluate constness of these later on? */
+    const _PDCLIB_wcinfo_t      *_WCType;
     _PDCLIB_size_t               _WCTypeSize;
-    _PDCLIB_ctype_t             *_CType; 
+    const _PDCLIB_ctype_t       *_CType; 
 
     /* perror/strerror */
     char                        *_ErrnoStr[_PDCLIB_ERRNO_MAX];
index efbc581f09b509cfe0e9e6943a0db848c204e2d1..7c73d1baf613dc9d8a15511831ff613e014a2c6c 100644 (file)
@@ -62,7 +62,7 @@ static bool c32toascii(
     return true;
 }
 
-struct _PDCLIB_charcodec _PDCLIB_ascii_codec = {
+const struct _PDCLIB_charcodec _PDCLIB_ascii_codec = {
     .__mbsinit   = ascii_mbsinit,
     .__mbstoc32s = asciitoc32,
     .__c32stombs = c32toascii,
index 00d2f2600d1b3bbb33dfedaeae5bf848eb38128c..b9de8cafc83bd2d59df317fceb052d569a8196d7 100644 (file)
@@ -60,7 +60,7 @@ static bool c32tolatin1(
     return true;
 }
 
-struct _PDCLIB_charcodec _PDCLIB_latin1_codec = {
+const struct _PDCLIB_charcodec _PDCLIB_latin1_codec = {
     .__mbsinit   = latin1_mbsinit,
     .__mbstoc32s = latin1toc32,
     .__c32stombs = c32tolatin1,
index a93454194fb04ea3a845168351a0ee86df2a46e8..22fa808c963fa33b4a1bfbd71565bfc141c5bc84 100644 (file)
@@ -232,7 +232,7 @@ static bool c32toutf8(
     END_CONVERSION;
 }
 
-struct _PDCLIB_charcodec _PDCLIB_utf8_codec = {
+const struct _PDCLIB_charcodec _PDCLIB_utf8_codec = {
     .__mbsinit   = utf8_mbsinit,
     .__mbstoc32s = utf8toc32,
     .__c32stombs = c32toutf8,
index 0e562c6a6df8db48f1075fd749f0abf2f05b14ce..77b5918b7472691a0283f7ad400f9d57af2dc353 100644 (file)
@@ -88,8 +88,7 @@ FILE * _PDCLIB_filelist = &_PDCLIB_sin;
    1 kByte (+ 4 byte) of <ctype.h> data.
    Each line: flags, lowercase, uppercase, collation.
 */
-static 
-_PDCLIB_ctype_t global_ctype[] = {
+static const _PDCLIB_ctype_t global_ctype[] = {
     { /* EOF */    0,    0,    0,    0 },
     { /* NUL */ _PDCLIB_CTYPE_CNTRL,                                             0x00, 0x00, 0x00 },
     { /* SOH */ _PDCLIB_CTYPE_CNTRL,                                             0x01, 0x01, 0x01 },
@@ -349,7 +348,7 @@ _PDCLIB_ctype_t global_ctype[] = {
     { 0x00, 0xFF, 0xFF, 0xFF }
 };
 
-extern struct _PDCLIB_charcodec _PDCLIB_ascii_codec;
+extern const struct _PDCLIB_charcodec _PDCLIB_ascii_codec;
 struct _PDCLIB_locale _PDCLIB_global_locale = {
     ._Codec = &_PDCLIB_ascii_codec,
     ._Conv  = { 
index 2d44fc3763357a451474b523169df2628f82a153..b9c9109afe5fa131b0ba50e23faea4e542adb1dd 100644 (file)
@@ -85,8 +85,7 @@ tss_t _PDCLIB_locale_tss;
    1 kByte (+ 4 byte) of <ctype.h> data.
    Each line: flags, lowercase, uppercase, collation.
 */
-static 
-_PDCLIB_ctype_t global_ctype[] = {
+static const _PDCLIB_ctype_t global_ctype[] = {
     { /* EOF */    0,    0,    0,    0 },
     { /* NUL */ _PDCLIB_CTYPE_CNTRL,                                             0x00, 0x00, 0x00 },
     { /* SOH */ _PDCLIB_CTYPE_CNTRL,                                             0x01, 0x01, 0x01 },
@@ -346,7 +345,7 @@ _PDCLIB_ctype_t global_ctype[] = {
     { 0x00, 0xFF, 0xFF, 0xFF }
 };
 
-extern struct _PDCLIB_charcodec _PDCLIB_ascii_codec;
+extern const struct _PDCLIB_charcodec _PDCLIB_ascii_codec;
 struct _PDCLIB_locale _PDCLIB_global_locale = {
     ._Codec = &_PDCLIB_ascii_codec,
     ._Conv  = {