EmbeddedPkg/libfdt: Add strncmp macro to use AsciiStrnCmp

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,
8e47649eff
2845d2d2cf
2cfd2fc904

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]
This commit is contained in:
Abner Chang 2020-08-06 10:34:21 +08:00 committed by mergify[bot]
parent 5ba203b54e
commit 019f513a19
1 changed files with 4 additions and 0 deletions

View File

@ -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 */