Skip to content

Commit

Permalink
EmbeddedPkg/libfdt: Add strncmp macro to use AsciiStrnCmp
Browse files Browse the repository at this point in the history
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,
riscv-software-src/opensbi@8e47649
riscv-software-src/opensbi@2845d2d
riscv-software-src/opensbi@2cfd2fc

Signed-off-by: Abner Chang <[email protected]>
Cc: Leif Lindholm <[email protected]>
Cc: Ard Biesheuvel <[email protected]>
Cc: Daniel Schaefer <[email protected]>
Message-Id: <[email protected]>
Reviewed-by: Leif Lindholm <[email protected]>
[[email protected]: remove stray newline between S-o-b and first Cc]
  • Loading branch information
Abner Chang authored and mergify[bot] committed Aug 24, 2020
1 parent 5ba203b commit 019f513
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions EmbeddedPkg/Include/libfdt_env.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,8 @@ static inline size_t strnlen (const char* str, size_t strsz ) {
return AsciiStrnLenS (str, strsz);
}

static inline size_t strncmp (const char* str1, const char* str2, size_t strsz ) {
return AsciiStrnCmp (str1, str2, strsz);
}

#endif /* _LIBFDT_ENV_H */

0 comments on commit 019f513

Please sign in to comment.