From 148f8169a4f2181e5f9a62e61dd6eedfadf99e3f Mon Sep 17 00:00:00 2001 From: Lenny Maiorani Date: Sat, 26 Mar 2022 16:55:39 -0600 Subject: [PATCH] LibWeb: Use date constants Make the code DRY (Don't Repeat Yourself) by using the `AK`-provided month name constants instead of copying them. --- Userland/Libraries/LibWeb/Cookie/ParsedCookie.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibWeb/Cookie/ParsedCookie.cpp b/Userland/Libraries/LibWeb/Cookie/ParsedCookie.cpp index 802a7fdc0b..7044d67d6d 100644 --- a/Userland/Libraries/LibWeb/Cookie/ParsedCookie.cpp +++ b/Userland/Libraries/LibWeb/Cookie/ParsedCookie.cpp @@ -5,6 +5,7 @@ */ #include "ParsedCookie.h" +#include #include #include #include @@ -263,10 +264,8 @@ Optional parse_date_time(StringView date_string) }; auto parse_month = [&](StringView token) { - static const char* months[] { "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec" }; - for (unsigned i = 0; i < 12; ++i) { - if (token.equals_ignoring_case(months[i])) { + if (token.equals_ignoring_case(short_month_names[i])) { month = i + 1; return true; }