This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 7bb97f7e22 elf: Replace {0x7f, 'E', 'L', 'F'} to EI_MAGIC
7bb97f7e22 is described below

commit 7bb97f7e22641704b3d7364f3e2f7c3a4d74b15c
Author: Xiang Xiao <xiaoxi...@xiaomi.com>
AuthorDate: Tue Jul 4 17:34:09 2023 +0800

    elf: Replace {0x7f, 'E', 'L', 'F'} to EI_MAGIC
    
    to avoid the duplication of the magic number.
    
    Signed-off-by: Xiang Xiao <xiaoxi...@xiaomi.com>
---
 binfmt/libelf/libelf_verify.c    | 5 +----
 libs/libc/modlib/modlib_verify.c | 6 +-----
 2 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/binfmt/libelf/libelf_verify.c b/binfmt/libelf/libelf_verify.c
index adc8e67bbf..be32ddaefd 100644
--- a/binfmt/libelf/libelf_verify.c
+++ b/binfmt/libelf/libelf_verify.c
@@ -39,10 +39,7 @@
  * Private Constant Data
  ****************************************************************************/
 
-static const char g_elfmagic[EI_MAGIC_SIZE] =
-{
-  0x7f, 'E', 'L', 'F'
-};
+static const char g_elfmagic[EI_MAGIC_SIZE] = EI_MAGIC;
 
 /****************************************************************************
  * Private Functions
diff --git a/libs/libc/modlib/modlib_verify.c b/libs/libc/modlib/modlib_verify.c
index b94633065d..6fa4a9e055 100644
--- a/libs/libc/modlib/modlib_verify.c
+++ b/libs/libc/modlib/modlib_verify.c
@@ -28,7 +28,6 @@
 #include <debug.h>
 #include <errno.h>
 
-#include <nuttx/arch.h>
 #include <nuttx/elf.h>
 #include <nuttx/lib/modlib.h>
 
@@ -36,10 +35,7 @@
  * Private Constant Data
  ****************************************************************************/
 
-static const char g_modmagic[EI_MAGIC_SIZE] =
-{
-    0x7f, 'E', 'L', 'F'
-};
+static const char g_modmagic[EI_MAGIC_SIZE] = EI_MAGIC;
 
 /****************************************************************************
  * Public Functions

Reply via email to