]> git.proxmox.com Git - mirror_edk2.git/commitdiff
EmbeddedPkg/libfdt: Add strncmp macro to use AsciiStrnCmp
authorAbner Chang <abner.chang@hpe.com>
Thu, 6 Aug 2020 02:34:21 +0000 (10:34 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Mon, 24 Aug 2020 17:19:33 +0000 (17:19 +0000)
For the implementation which utilizes libfdt provided in EmbeddedPkg
however it uses strncmp function in the libfdt helper library,
libfdt_env.h should provide the macro implied with edk2 strncmp
implementation.

The example is RISC-V OpenSBI library. edk2 RISC-V port uses OpenSBI
library and incorporate with edk2 libfdt. edk2 libfdt_env.h provides
the necessary macros to build OpenSBI which uses fdt functions in edk2
environment. However, OpenSBI also has libfdt helper library that uses
strncmp function which is not defined in edk2 libfdt_env.h. This commit
addresses the build issue caused by missing strncmp macro in
libfdt_env.h.

Check below three commits for the corresponding changes on OpenSBI,
https://github.com/riscv/opensbi/commit/8e47649eff96c303e02fbd58cdc6c4ed341066ec
https://github.com/riscv/opensbi/commit/2845d2d2cf4fb74a89452ba223995aa4a118c07e
https://github.com/riscv/opensbi/commit/2cfd2fc9048806353298a1b967abf985901e36e8

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Message-Id: <20200806023421.25161-1-abner.chang@hpe.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
[lersek@redhat.com: remove stray newline between S-o-b and first Cc]

EmbeddedPkg/Include/libfdt_env.h

index 11a97647333e64ca2b16e4760163b12c9bb82eff..7feff52bc0fb456bc1940699f62cc8c224187fa3 100644 (file)
@@ -76,4 +76,8 @@ static inline size_t strnlen (const char* str, size_t strsz ) {
   return AsciiStrnLenS (str, strsz);\r
 }\r
 \r
+static inline size_t strncmp (const char* str1, const char* str2, size_t strsz ) {\r
+  return AsciiStrnCmp (str1, str2, strsz);\r
+}\r
+\r
 #endif /* _LIBFDT_ENV_H */\r