core: Prefer JS_AtomToCString() over JS_AtomToString() + JS_ToCString().
Some checks failed
Build Tilde Friends / Build-All (push) Has been cancelled

This commit is contained in:
2025-06-11 12:46:52 -04:00
parent 18908b6b56
commit 2f0a2ac6b0
4 changed files with 5 additions and 15 deletions

View File

@ -75,7 +75,6 @@ static int _object_to_headers(JSContext* context, JSValue object, const char** h
JS_GetOwnPropertyNames(context, &ptab, &plen, object, JS_GPN_STRING_MASK);
for (; count < (int)plen && count < headers_length / 2; ++count)
{
JSValue key = JS_AtomToString(context, ptab[count].atom);
JSPropertyDescriptor desc;
JSValue key_value = JS_NULL;
if (JS_GetOwnProperty(context, &desc, object, ptab[count].atom) == 1)
@ -84,9 +83,8 @@ static int _object_to_headers(JSContext* context, JSValue object, const char** h
JS_FreeValue(context, desc.setter);
JS_FreeValue(context, desc.getter);
}
headers[count * 2 + 0] = JS_ToCString(context, key);
headers[count * 2 + 0] = JS_AtomToCString(context, ptab[count].atom);
headers[count * 2 + 1] = JS_ToCString(context, key_value);
JS_FreeValue(context, key);
JS_FreeValue(context, key_value);
}
for (uint32_t i = 0; i < plen; ++i)