mirror of
https://git.proxmox.com/git/efi-boot-shim
synced 2025-08-13 09:58:16 +00:00
includes: add strchra() and strchrnula() impls
Unfortunately GNU-EFI doesn't currently implement ascii versions of strchr() or strchrnul(), and we kind of need them, so add an implementation here for now. Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
parent
4a4d73f73a
commit
186595864c
@ -64,4 +64,30 @@ translate_slashes(CHAR8 *out, const char *str)
|
||||
return out;
|
||||
}
|
||||
|
||||
static inline UNUSED CHAR8 *
|
||||
strchrnula(const CHAR8 *s, int c)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if (s == NULL)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; s[i] != '\000' && s[i] != c; i++)
|
||||
;
|
||||
|
||||
return (CHAR8 *)&s[i];
|
||||
}
|
||||
|
||||
static inline UNUSED CHAR8 *
|
||||
strchra(const CHAR8 *s, int c)
|
||||
{
|
||||
const CHAR8 *s1;
|
||||
|
||||
s1 = strchrnula(s, c);
|
||||
if (!s1 || s1[0] == '\000')
|
||||
return NULL;
|
||||
|
||||
return (CHAR8 *)s1;
|
||||
}
|
||||
|
||||
#endif /* SHIM_STR_H */
|
||||
|
Loading…
Reference in New Issue
Block a user