summaryrefslogtreecommitdiffstats
path: root/Modules/cjkcodecs/_codecs_jp.c
diff options
context:
space:
mode:
authorErlend E. Aasland <erlend.aasland@protonmail.com>2023-04-17 00:41:25 (GMT)
committerGitHub <noreply@github.com>2023-04-17 00:41:25 (GMT)
commit217911ede5d52b02b2e3c9222439e1ea08545291 (patch)
treec5ce2f736752084bece9e383458b443df69b6b97 /Modules/cjkcodecs/_codecs_jp.c
parentff3303e49c13495d8d9cf1dc0cf0624bbda1d3ae (diff)
downloadcpython-217911ede5d52b02b2e3c9222439e1ea08545291.zip
cpython-217911ede5d52b02b2e3c9222439e1ea08545291.tar.gz
cpython-217911ede5d52b02b2e3c9222439e1ea08545291.tar.bz2
gh-103583: Add codecs and maps to _codecs_* module state (#103540)
Diffstat (limited to 'Modules/cjkcodecs/_codecs_jp.c')
-rw-r--r--Modules/cjkcodecs/_codecs_jp.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/Modules/cjkcodecs/_codecs_jp.c b/Modules/cjkcodecs/_codecs_jp.c
index 3a33295..7a8b78a 100644
--- a/Modules/cjkcodecs/_codecs_jp.c
+++ b/Modules/cjkcodecs/_codecs_jp.c
@@ -733,7 +733,7 @@ DECODER(shift_jis_2004)
}
-BEGIN_MAPPINGS_LIST
+BEGIN_MAPPINGS_LIST(11)
MAPPING_DECONLY(jisx0208)
MAPPING_DECONLY(jisx0212)
MAPPING_ENCONLY(jisxcommon)
@@ -747,14 +747,19 @@ BEGIN_MAPPINGS_LIST
MAPPING_ENCDEC(cp932ext)
END_MAPPINGS_LIST
-BEGIN_CODECS_LIST
+#define CODEC_CUSTOM(NAME, N, METH) \
+ NEXT_CODEC = (MultibyteCodec){NAME, (void *)N, NULL, _STATELESS_METHODS(METH)};
+
+BEGIN_CODECS_LIST(7)
CODEC_STATELESS(shift_jis)
CODEC_STATELESS(cp932)
CODEC_STATELESS(euc_jp)
CODEC_STATELESS(shift_jis_2004)
CODEC_STATELESS(euc_jis_2004)
- { "euc_jisx0213", (void *)2000, NULL, _STATELESS_METHODS(euc_jis_2004) },
- { "shift_jisx0213", (void *)2000, NULL, _STATELESS_METHODS(shift_jis_2004) },
+ CODEC_CUSTOM("euc_jisx0213", 2000, euc_jis_2004)
+ CODEC_CUSTOM("shift_jisx0213", 2000, shift_jis_2004)
END_CODECS_LIST
+#undef CODEC_CUSTOM
+
I_AM_A_MODULE_FOR(jp)