1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:07:34 +00:00

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.
This commit is contained in:
Idan Horowitz 2022-02-15 23:02:45 +02:00 committed by Andreas Kling
parent 5b572393a9
commit 4a15ed6164
3 changed files with 25 additions and 5 deletions

View file

@ -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
};
}