public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Jeff Brasen via groups.io" <jbrasen=nvidia.com@groups.io>
To: <devel@edk2.groups.io>
Cc: Jeff Brasen <jbrasen@nvidia.com>
Subject: [edk2-devel] [PATCH] MdePkg/BaseFdtLib: Rename standard functions
Date: Mon, 11 Dec 2023 07:39:44 -0800	[thread overview]
Message-ID: <2c864678a4ae43a9cec9825b7f408c140ba1f18e.1702309158.git.jbrasen@nvidia.com> (raw)

Rename the standard functions in the LibFdtSupport to remove conflicts
with other libraries that define them.

Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
---
 MdePkg/Library/BaseFdtLib/LibFdtSupport.h | 16 +++++++++++++++
 MdePkg/Library/BaseFdtLib/LibFdtWrapper.c | 25 ++---------------------
 2 files changed, 18 insertions(+), 23 deletions(-)

diff --git a/MdePkg/Library/BaseFdtLib/LibFdtSupport.h b/MdePkg/Library/BaseFdtLib/LibFdtSupport.h
index 393019324b..47beac9fac 100644
--- a/MdePkg/Library/BaseFdtLib/LibFdtSupport.h
+++ b/MdePkg/Library/BaseFdtLib/LibFdtSupport.h
@@ -68,6 +68,12 @@ strrchr    (
   int
   );
 
+char *
+fdt_strrchr    (
+  const char *,
+  int
+  );
+
 unsigned long
 strtoul     (
   const char *,
@@ -75,6 +81,13 @@ strtoul     (
   int
   );
 
+unsigned long
+fdt_strtoul     (
+  const char *,
+  char **,
+  int
+  );
+
 char *
 strcpy (
   char        *strDest,
@@ -93,7 +106,10 @@ strcpy (
 #define strnlen(str, count)                 (size_t)(AsciiStrnLenS(str, count))
 #define strncpy(strDest, strSource, count)  AsciiStrnCpyS(strDest, MAX_STRING_SIZE, strSource, (UINTN)count)
 #define strcat(strDest, strSource)          AsciiStrCatS(strDest, MAX_STRING_SIZE, strSource)
+#define strchr(str, ch)                     ScanMem8(str, AsciiStrSize (str), (UINT8)ch)
 #define strcmp(string1, string2, count)     (int)(AsciiStrCmp(string1, string2))
 #define strncmp(string1, string2, count)    (int)(AsciiStrnCmp(string1, string2, (UINTN)(count)))
+#define strrchr(str, ch)                    fdt_strrchr(str, ch)
+#define strtoul(ptr, end_ptr, base)         fdt_strtoul(ptr, end_ptr, base)
 
 #endif /* FDT_LIB_SUPPORT_H_ */
diff --git a/MdePkg/Library/BaseFdtLib/LibFdtWrapper.c b/MdePkg/Library/BaseFdtLib/LibFdtWrapper.c
index ef6452914f..1a4cd573fd 100644
--- a/MdePkg/Library/BaseFdtLib/LibFdtWrapper.c
+++ b/MdePkg/Library/BaseFdtLib/LibFdtWrapper.c
@@ -18,28 +18,7 @@
 // so the code gets a bit clunky to handle that case specifically.
 
 char *
-strchr (
-  const char  *Str,
-  int         Char
-  )
-{
-  char  *S;
-
-  S = (char *)Str;
-
-  for ( ; ; S++) {
-    if (*S == Char) {
-      return S;
-    }
-
-    if (*S == '\0') {
-      return NULL;
-    }
-  }
-}
-
-char *
-strrchr (
+fdt_strrchr (
   const char  *Str,
   int         Char
   )
@@ -71,7 +50,7 @@ __isspace (
 }
 
 unsigned long
-strtoul (
+fdt_strtoul (
   const char  *Nptr,
   char        **EndPtr,
   int         Base
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112308): https://edk2.groups.io/g/devel/message/112308
Mute This Topic: https://groups.io/mt/103110792/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



             reply	other threads:[~2023-12-11 15:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-11 15:39 Jeff Brasen via groups.io [this message]
2023-12-11 15:59 ` [edk2-devel] [PATCH] MdePkg/BaseFdtLib: Rename standard functions Pedro Falcato
2023-12-11 16:52   ` Jeff Brasen via groups.io
2024-01-23 17:20     ` Jeff Brasen via groups.io
2024-01-23 21:55 ` Michael D Kinney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2c864678a4ae43a9cec9825b7f408c140ba1f18e.1702309158.git.jbrasen@nvidia.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox