summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAbner Chang <abner.chang@hpe.com>2021-08-05 12:52:39 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-08-05 06:11:34 +0000
commit9abc60f9f722d891b3cedb0205fd6c9c0e2af54b (patch)
treed46809069595cbad2fe0feb6f523e10c4b4b09b7
parent63552872061130e236ab30f81cfe5a6714cd0012 (diff)
downloadedk2-9abc60f9f722d891b3cedb0205fd6c9c0e2af54b.tar.gz
edk2-9abc60f9f722d891b3cedb0205fd6c9c0e2af54b.tar.bz2
edk2-9abc60f9f722d891b3cedb0205fd6c9c0e2af54b.zip
EmbeddedPkg/libfdt: Add strcmp and strncpy to libfdt_env.h
OpenSBI has started using those in v0.9. See: https://github.com/riscv/opensbi/blob/v0.9/lib/utils/fdt/fdt_domain.c 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> Cc: Anup Patel <anup.patel@wdc.com> Signed-off-by: Daniel Schaefer <daniel.schaefer@hpe.com> Acked-by: Leif Lindholm <leif@nuviainc.com>
-rw-r--r--EmbeddedPkg/Include/libfdt_env.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/EmbeddedPkg/Include/libfdt_env.h b/EmbeddedPkg/Include/libfdt_env.h
index 7feff52bc0..c35ac73970 100644
--- a/EmbeddedPkg/Include/libfdt_env.h
+++ b/EmbeddedPkg/Include/libfdt_env.h
@@ -76,8 +76,16 @@ static inline size_t strnlen (const char* str, size_t strsz ) {
return AsciiStrnLenS (str, strsz);
}
+static inline size_t strcmp (const char* str1, const char* str2) {
+ return AsciiStrCmp (str1, str2);
+}
+
static inline size_t strncmp (const char* str1, const char* str2, size_t strsz ) {
return AsciiStrnCmp (str1, str2, strsz);
}
+static inline size_t strncpy (char* dest, const char* source, size_t dest_max) {
+ return AsciiStrCpyS (dest, dest_max, source);
+}
+
#endif /* _LIBFDT_ENV_H */