Skip to content

Commit e65749c

Browse files
committed
MdePkg/BaseFdtLib: Rename standard functions
Rename the standard functions in the LibFdtSupport to remove conflicts with other libraries that define them. Jira TEGRAUEFI-3105 Signed-off-by: Jeff Brasen <[email protected]> Change-Id: Ib0683a29f9aeb7e9c7fa179e9d495c3e979f1261
1 parent eccdab6 commit e65749c

File tree

2 files changed

+18
-23
lines changed

2 files changed

+18
-23
lines changed

MdePkg/Library/BaseFdtLib/LibFdtSupport.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,26 @@ strrchr (
6868
int
6969
);
7070

71+
char *
72+
fdt_strrchr (
73+
const char *,
74+
int
75+
);
76+
7177
unsigned long
7278
strtoul (
7379
const char *,
7480
char **,
7581
int
7682
);
7783

84+
unsigned long
85+
fdt_strtoul (
86+
const char *,
87+
char **,
88+
int
89+
);
90+
7891
char *
7992
strcpy (
8093
char *strDest,
@@ -93,7 +106,10 @@ strcpy (
93106
#define strnlen(str, count) (size_t)(AsciiStrnLenS(str, count))
94107
#define strncpy(strDest, strSource, count) AsciiStrnCpyS(strDest, MAX_STRING_SIZE, strSource, (UINTN)count)
95108
#define strcat(strDest, strSource) AsciiStrCatS(strDest, MAX_STRING_SIZE, strSource)
109+
#define strchr(str, ch) ScanMem8(str, AsciiStrSize (str), (UINT8)ch)
96110
#define strcmp(string1, string2, count) (int)(AsciiStrCmp(string1, string2))
97111
#define strncmp(string1, string2, count) (int)(AsciiStrnCmp(string1, string2, (UINTN)(count)))
112+
#define strrchr(str, ch) fdt_strrchr(str, ch)
113+
#define strtoul(ptr, end_ptr, base) fdt_strtoul(ptr, end_ptr, base)
98114

99115
#endif /* FDT_LIB_SUPPORT_H_ */

MdePkg/Library/BaseFdtLib/LibFdtWrapper.c

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,7 @@
1818
// so the code gets a bit clunky to handle that case specifically.
1919

2020
char *
21-
strchr (
22-
const char *Str,
23-
int Char
24-
)
25-
{
26-
char *S;
27-
28-
S = (char *)Str;
29-
30-
for ( ; ; S++) {
31-
if (*S == Char) {
32-
return S;
33-
}
34-
35-
if (*S == '\0') {
36-
return NULL;
37-
}
38-
}
39-
}
40-
41-
char *
42-
strrchr (
21+
fdt_strrchr (
4322
const char *Str,
4423
int Char
4524
)
@@ -71,7 +50,7 @@ __isspace (
7150
}
7251

7352
unsigned long
74-
strtoul (
53+
fdt_strtoul (
7554
const char *Nptr,
7655
char **EndPtr,
7756
int Base

0 commit comments

Comments
 (0)