summaryrefslogtreecommitdiff
path: root/lib/str.c
diff options
context:
space:
mode:
authorNigel Croxon <nigel.croxon@hpe.com>2016-03-25 13:32:54 -0400
committerNigel Croxon <nigel.croxon@hpe.com>2016-03-25 13:32:54 -0400
commit5ff74ecae8b8452e3630bb00611fb610da72ac59 (patch)
tree682118a6d6f355f7dd01de25c8ae479a67b7358c /lib/str.c
parent1acb1d9dae8192e72e3de7ac826f47263fe280c5 (diff)
downloadgnu-efi-5ff74ecae8b8452e3630bb00611fb610da72ac59.tar.gz
Commit 3dd05c and subsequent ones introduced the use of the GNU
specific __attribute__((__unused__)), which breaks MSVC compilation... I'll use this as a reminder that gnu-efi is compiled with more than GNU toolchains, and that contributors might want to be careful about adding GNU-specific extensions... This patch does the following: Create a new eficompiler.h header that sets all compiler-specific options and extensions Create a new EFI_UNUSED macro to be used in lieu of __attribute__((__unused__)) and applies it to the relevant sources Move the ALIGN(x) macro, previously defined in efisetjmp.h to the new header Oh, and it also fixes a bunch of trailing whitespaces (because my code editor is set to do just that by default). Signed-off-by: Pete Batard <pbatard@users.sf.net> Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
Diffstat (limited to 'lib/str.c')
-rw-r--r--lib/str.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/lib/str.c b/lib/str.c
index 6a87fde..cf1495c 100644
--- a/lib/str.c
+++ b/lib/str.c
@@ -52,8 +52,7 @@ StrnCmp (
INTN EFIAPI
LibStubStriCmp (
- IN EFI_UNICODE_COLLATION_INTERFACE *This
- __attribute__((__unused__)),
+ IN EFI_UNICODE_COLLATION_INTERFACE *This EFI_UNUSED,
IN CHAR16 *s1,
IN CHAR16 *s2
)
@@ -63,8 +62,8 @@ LibStubStriCmp (
VOID EFIAPI
LibStubStrLwrUpr (
- IN EFI_UNICODE_COLLATION_INTERFACE *This __attribute__((__unused__)),
- IN CHAR16 *Str __attribute__((__unused__))
+ IN EFI_UNICODE_COLLATION_INTERFACE *This EFI_UNUSED,
+ IN CHAR16 *Str EFI_UNUSED
)
{
}
@@ -119,7 +118,7 @@ StrCat (
IN CHAR16 *Dest,
IN CONST CHAR16 *Src
)
-{
+{
RtStrCat(Dest, Src);
}
@@ -165,7 +164,7 @@ strlena (
// string length
{
UINTN len;
-
+
for (len=0; *s1; s1+=1, len+=1) ;
return len;
}
@@ -270,7 +269,7 @@ Atoi (
return u;
}
-BOOLEAN
+BOOLEAN
MetaMatch (
IN CHAR16 *String,
IN CHAR16 *Pattern
@@ -283,11 +282,11 @@ MetaMatch (
Pattern += 1;
switch (p) {
- case 0:
+ case 0:
// End of pattern. If end of string, TRUE match
- return *String ? FALSE : TRUE;
+ return *String ? FALSE : TRUE;
- case '*':
+ case '*':
// Match zero or more chars
while (*String) {
if (MetaMatch (String, Pattern)) {
@@ -297,7 +296,7 @@ MetaMatch (
}
return MetaMatch (String, Pattern);
- case '?':
+ case '?':
// Match any one char
if (!*String) {
return FALSE;
@@ -305,7 +304,7 @@ MetaMatch (
String += 1;
break;
- case '[':
+ case '[':
// Match char set
c = *String;
if (!c) {
@@ -324,17 +323,17 @@ MetaMatch (
return FALSE; // syntax problem
}
- if (c >= l && c <= p) { // if in range,
+ if (c >= l && c <= p) { // if in range,
break; // it's a match
}
}
-
+
l = p;
if (c == p) { // if char matches
break; // move on
}
}
-
+
// skip to end of match char set
while (p && p != ']') {
p = *Pattern;
@@ -359,8 +358,7 @@ MetaMatch (
BOOLEAN EFIAPI
LibStubMetaiMatch (
- IN EFI_UNICODE_COLLATION_INTERFACE *This
- __attribute__((__unused__)),
+ IN EFI_UNICODE_COLLATION_INTERFACE *This EFI_UNUSED,
IN CHAR16 *String,
IN CHAR16 *Pattern
)
@@ -369,7 +367,7 @@ LibStubMetaiMatch (
}
-BOOLEAN
+BOOLEAN
MetaiMatch (
IN CHAR16 *String,
IN CHAR16 *Pattern