From 83a187784a9f0eb564bda43c3d71a47bb1f3ba12 Mon Sep 17 00:00:00 2001 From: libretroadmin Date: Tue, 24 Dec 2024 21:09:15 +0100 Subject: [PATCH] Remove dependency on strlcpy for rjson.c --- libretro-common/formats/json/rjson.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libretro-common/formats/json/rjson.c b/libretro-common/formats/json/rjson.c index fccb80daa3..07fcf25814 100644 --- a/libretro-common/formats/json/rjson.c +++ b/libretro-common/formats/json/rjson.c @@ -107,12 +107,9 @@ static enum rjson_type _rjson_error_char(rjson_t *json, char buf[16]; if (json->stack_top->type == RJSON_ERROR) return RJSON_ERROR; - if (chr == _rJSON_EOF) - strlcpy(buf, "end of stream", sizeof(buf)); - else if (chr >= ' ' && chr <= '~') - snprintf(buf, sizeof(buf), "'%c'", chr); - else - snprintf(buf, sizeof(buf), "byte 0x%02X", chr); + snprintf(buf, sizeof(buf), + (chr == _rJSON_EOF ? "end of stream" : + (chr >= ' ' && chr <= '~' ? "'%c'" : "byte 0x%02X")), chr); return _rjson_error(json, fmt, buf); }