Skip to content

Commit 0ffc1f5

Browse files
committed
Refactor mbfl_ident.c, mbfl_encoding.c, mbfl_memory_device.c, mbfl_string.c
- Make everything less gratuitously verbose - Don't litter the code with lots of unneeded NULL checks (for things which will never be NULL) - Don't return success/failure code from functions which can never fail - For encoding structs, don't use pointers to pointers to pointers for the list of alias strings. Pointers to pointers (2 levels of indirection) is what actually makes sense. This gets rid of some extraneous dereference operations.
1 parent e8b8ecb commit 0ffc1f5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+183
-307
lines changed

ext/mbstring/libmbfl/filters/mbfilter_armscii8.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const mbfl_encoding mbfl_encoding_armscii8 = {
3838
mbfl_no_encoding_armscii8,
3939
"ArmSCII-8",
4040
"ArmSCII-8",
41-
(const char *(*)[])&mbfl_encoding_armscii8_aliases,
41+
mbfl_encoding_armscii8_aliases,
4242
NULL,
4343
MBFL_ENCTYPE_SBCS,
4444
&vtbl_armscii8_wchar,

ext/mbstring/libmbfl/filters/mbfilter_ascii.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const mbfl_encoding mbfl_encoding_ascii = {
3939
mbfl_no_encoding_ascii,
4040
"ASCII",
4141
"US-ASCII", /* preferred MIME name */
42-
(const char *(*)[])&mbfl_encoding_ascii_aliases,
42+
mbfl_encoding_ascii_aliases,
4343
NULL,
4444
MBFL_ENCTYPE_SBCS,
4545
&vtbl_ascii_wchar,

ext/mbstring/libmbfl/filters/mbfilter_big5.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const mbfl_encoding mbfl_encoding_big5 = {
5959
mbfl_no_encoding_big5,
6060
"BIG-5",
6161
"BIG5",
62-
(const char *(*)[])&mbfl_encoding_big5_aliases,
62+
mbfl_encoding_big5_aliases,
6363
mblen_table_big5,
6464
MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE,
6565
&vtbl_big5_wchar,

ext/mbstring/libmbfl/filters/mbfilter_cp1251.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const mbfl_encoding mbfl_encoding_cp1251 = {
3939
mbfl_no_encoding_cp1251,
4040
"Windows-1251",
4141
"Windows-1251",
42-
(const char *(*)[])&mbfl_encoding_cp1251_aliases,
42+
mbfl_encoding_cp1251_aliases,
4343
NULL,
4444
MBFL_ENCTYPE_SBCS,
4545
&vtbl_cp1251_wchar,

ext/mbstring/libmbfl/filters/mbfilter_cp1252.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const mbfl_encoding mbfl_encoding_cp1252 = {
3939
mbfl_no_encoding_cp1252,
4040
"Windows-1252",
4141
"Windows-1252",
42-
(const char *(*)[])&mbfl_encoding_cp1252_aliases,
42+
mbfl_encoding_cp1252_aliases,
4343
NULL,
4444
MBFL_ENCTYPE_SBCS,
4545
&vtbl_cp1252_wchar,

ext/mbstring/libmbfl/filters/mbfilter_cp1254.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const mbfl_encoding mbfl_encoding_cp1254 = {
3939
mbfl_no_encoding_cp1254,
4040
"Windows-1254",
4141
"Windows-1254",
42-
(const char *(*)[])&mbfl_encoding_cp1254_aliases,
42+
mbfl_encoding_cp1254_aliases,
4343
NULL,
4444
MBFL_ENCTYPE_SBCS,
4545
&vtbl_cp1254_wchar,

ext/mbstring/libmbfl/filters/mbfilter_cp5022x.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const mbfl_encoding mbfl_encoding_cp50220 = {
5959
mbfl_no_encoding_cp50220,
6060
"CP50220",
6161
"ISO-2022-JP",
62-
(const char *(*)[])NULL,
62+
NULL,
6363
NULL,
6464
MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE,
6565
&vtbl_cp50220_wchar,
@@ -70,7 +70,7 @@ const mbfl_encoding mbfl_encoding_cp50220raw = {
7070
mbfl_no_encoding_cp50220raw,
7171
"CP50220raw",
7272
"ISO-2022-JP",
73-
(const char *(*)[])NULL,
73+
NULL,
7474
NULL,
7575
MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_GL_UNSAFE,
7676
&vtbl_cp50220raw_wchar,

ext/mbstring/libmbfl/filters/mbfilter_cp51932.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const mbfl_encoding mbfl_encoding_cp51932 = {
6868
mbfl_no_encoding_cp51932,
6969
"CP51932",
7070
"CP51932",
71-
(const char *(*)[])&mbfl_encoding_cp51932_aliases,
71+
mbfl_encoding_cp51932_aliases,
7272
mblen_table_eucjp,
7373
MBFL_ENCTYPE_MBCS,
7474
&vtbl_cp51932_wchar,

ext/mbstring/libmbfl/filters/mbfilter_cp850.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const mbfl_encoding mbfl_encoding_cp850 = {
3535
mbfl_no_encoding_cp850,
3636
"CP850",
3737
"CP850",
38-
(const char *(*)[])&mbfl_encoding_cp850_aliases,
38+
mbfl_encoding_cp850_aliases,
3939
NULL,
4040
MBFL_ENCTYPE_SBCS,
4141
&vtbl_cp850_wchar,

ext/mbstring/libmbfl/filters/mbfilter_cp866.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const mbfl_encoding mbfl_encoding_cp866 = {
3939
mbfl_no_encoding_cp866,
4040
"CP866",
4141
"CP866",
42-
(const char *(*)[])&mbfl_encoding_cp866_aliases,
42+
mbfl_encoding_cp866_aliases,
4343
NULL,
4444
MBFL_ENCTYPE_SBCS,
4545
&vtbl_cp866_wchar,

0 commit comments

Comments
 (0)