summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibEDID/EDID.h
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2022-02-15 23:02:45 +0200
committerAndreas Kling <kling@serenityos.org>2022-02-16 22:21:37 +0100
commit4a15ed616472e6badca8cfe8f30fb5e38a0391b6 (patch)
tree9a649b1f7a30086c96d09d60952be9dc8c5eb761 /Userland/Libraries/LibEDID/EDID.h
parent5b572393a96e0ad1a916a422c47a257cd6da635b (diff)
downloadserenity-4a15ed616472e6badca8cfe8f30fb5e38a0391b6.zip
LibEDID: Store EDID version instead of allocating on each getter call
This also let's us use a KString instead of a string when we're in the Kernel, which opens the path for OOM-failure propagation.
Diffstat (limited to 'Userland/Libraries/LibEDID/EDID.h')
-rw-r--r--Userland/Libraries/LibEDID/EDID.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/Userland/Libraries/LibEDID/EDID.h b/Userland/Libraries/LibEDID/EDID.h
index c42dd16cbb..9cf0ae02b2 100644
--- a/Userland/Libraries/LibEDID/EDID.h
+++ b/Userland/Libraries/LibEDID/EDID.h
@@ -6,17 +6,23 @@
#pragma once
+#include <AK/ByteBuffer.h>
#include <AK/ByteReader.h>
#include <AK/Endian.h>
#include <AK/Error.h>
#include <AK/FixedPoint.h>
#include <AK/Forward.h>
#include <AK/Span.h>
-#include <AK/String.h>
#include <AK/Vector.h>
#include <LibEDID/DMT.h>
#include <LibEDID/VIC.h>
+#ifdef KERNEL
+# include <Kernel/KString.h>
+#else
+# include <AK/String.h>
+#endif
+
namespace EDID {
namespace Definitions {
@@ -415,7 +421,7 @@ public:
bool operator==(Parser const& other) const;
- String version() const;
+ StringView version() const;
auto bytes() const { return m_bytes; }
@@ -442,6 +448,11 @@ private:
ByteBuffer m_bytes_buffer;
ReadonlyBytes m_bytes;
u8 m_revision { 0 };
+#ifdef KERNEL
+ OwnPtr<Kernel::KString> m_version;
+#else
+ String m_version;
+#endif
};
}