From b2f15537bb0eb8e601985a058e87bc7cbdc2812d Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 25 Oct 2021 13:16:59 +0200 Subject: [PATCH] AK: Add fast path for constructing StringImpl from "" literal --- AK/StringImpl.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AK/StringImpl.cpp b/AK/StringImpl.cpp index 0b27d60c498..a7e95b847b8 100644 --- a/AK/StringImpl.cpp +++ b/AK/StringImpl.cpp @@ -78,6 +78,9 @@ RefPtr StringImpl::create(const char* cstring, ShouldChomp shouldCho if (!cstring) return nullptr; + if (!*cstring) + return the_empty_stringimpl(); + return create(cstring, strlen(cstring), shouldChomp); }