File 3233-erts-Use-strlen.patch of Package erlang

From c99ad7461358a2428521b287e86e58d9e13167d3 Mon Sep 17 00:00:00 2001
From: Sverker Eriksson <sverker@erlang.org>
Date: Tue, 28 May 2024 19:43:38 +0200
Subject: [PATCH 3/4] erts: Use strlen

---
 erts/emulator/beam/hash.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/erts/emulator/beam/hash.c b/erts/emulator/beam/hash.c
index 5c8b43e6e2..67febabe8f 100644
--- a/erts/emulator/beam/hash.c
+++ b/erts/emulator/beam/hash.c
@@ -98,10 +98,8 @@ void hash_info(fmtfn_t to, void *arg, Hash* h)
 int
 hash_table_sz(Hash *h)
 {
-  int i;
-  for(i=0;h->name[i];i++);
-  i++;
-  return sizeof(Hash) + hash_get_slots(h)*sizeof(HashBucket*) + i;
+  const int name_len = strlen(h->name) + 1;
+  return sizeof(Hash) + hash_get_slots(h)*sizeof(HashBucket*) + name_len;
 }
 
 
-- 
2.35.3

openSUSE Build Service is sponsored by