Quellcode durchsuchen

LibELF: Exclude MemoryRegionInfo::object_name() from the Kernel

This API is only used by userland, and it uses infallible Strings, so
let's just ifdef it out of the Kernel.
Idan Horowitz vor 3 Jahren
Ursprung
Commit
1616460312
1 geänderte Dateien mit 6 neuen und 1 gelöschten Zeilen
  1. 6 1
      Userland/Libraries/LibELF/Core.h

+ 6 - 1
Userland/Libraries/LibELF/Core.h

@@ -6,10 +6,13 @@
 
 
 #pragma once
 #pragma once
 
 
-#include <AK/String.h>
 #include <AK/Types.h>
 #include <AK/Types.h>
 #include <LibC/sys/arch/i386/regs.h>
 #include <LibC/sys/arch/i386/regs.h>
 
 
+#ifndef KERNEL
+#    include <AK/String.h>
+#endif
+
 namespace ELF::Core {
 namespace ELF::Core {
 
 
 struct [[gnu::packed]] NotesEntryHeader {
 struct [[gnu::packed]] NotesEntryHeader {
@@ -55,6 +58,7 @@ struct [[gnu::packed]] MemoryRegionInfo {
     uint16_t program_header_index;
     uint16_t program_header_index;
     char region_name[]; // Null terminated
     char region_name[]; // Null terminated
 
 
+#ifndef KERNEL
     String object_name() const
     String object_name() const
     {
     {
         StringView memory_region_name { region_name };
         StringView memory_region_name { region_name };
@@ -65,6 +69,7 @@ struct [[gnu::packed]] MemoryRegionInfo {
             return {};
             return {};
         return memory_region_name.substring_view(0, *maybe_colon_index).to_string();
         return memory_region_name.substring_view(0, *maybe_colon_index).to_string();
     }
     }
+#endif
 };
 };
 
 
 struct [[gnu::packed]] Metadata {
 struct [[gnu::packed]] Metadata {