summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2026-05-21 09:21:18 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2026-05-23 19:18:53 -0700
commitc72e6cdc464e295d821da24232a2913bbcecf3f8 (patch)
treeaf40b5e0b89cdb5e401a93c85cecfa49d05e316c
parentced12fa1140879d92a66475cf2a167e699e8e1c0 (diff)
Avoid memsets in coding.c
* src/coding.c (detect_coding_utf_16, Fset_coding_system_priority): Rewrite memset to initializers.
-rw-r--r--src/coding.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/coding.c b/src/coding.c
index aea4c0cea5f..9aba2a7eacc 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -1534,11 +1534,9 @@ detect_coding_utf_16 (struct coding_system *coding,
{
/* We check the dispersion of Eth and Oth bytes where E is even and
O is odd. If both are high, we assume binary data.*/
- unsigned char e[256], o[256];
+ unsigned char e[256] = {0}, o[256] = {0};
unsigned e_num = 1, o_num = 1;
- memset (e, 0, 256);
- memset (o, 0, 256);
e[c1] = 1;
o[c2] = 1;
@@ -10886,11 +10884,9 @@ usage: (set-coding-system-priority &rest coding-systems) */)
(ptrdiff_t nargs, Lisp_Object *args)
{
ptrdiff_t i, j;
- bool changed[coding_category_max];
+ bool changed[coding_category_max] = {0};
enum coding_category priorities[coding_category_max];
- memset (changed, 0, sizeof changed);
-
for (i = j = 0; i < nargs; i++)
{
enum coding_category category;