1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[smjs] minor optimisation: one strlen less

This commit is contained in:
Witold Filipczyk 2022-06-18 22:00:49 +02:00
parent 21cf493377
commit f72f2ae60a

View File

@ -113,12 +113,9 @@ jsval_to_Latin1(JSContext *ctx, JS::HandleValue hvp, size_t *length)
/* Memory must be freed in caller */
JSString *st = JS::ToString(ctx, hvp);
JS::UniqueChars chars = JS_EncodeStringToLatin1(ctx, st);
*length = JS_GetStringLength(st);
if (length) {
*length = JS_GetStringLength(st);
}
return null_or_stracpy(chars.get());
return memacpy(chars.get(), *length);
}
static bool