From 9d4302deb237d0b65696ded4924206626e4dd997 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 30 Mar 2026 00:35:56 +0100 Subject: libreboot-utils: optimised string functions operate per word, not per byte this is also done on sdup, which uses a slightly inefficient method: the new string allocation is that of the maximum size, rather than what we need. for example, if you wanted a 20 character string (21 including null), you would still allocate 4096 bytes if that was the maximum length. it's a bit naughty, and i have half a mind to keep sdup on the old implementation, but i'll leave it be for now. Signed-off-by: Leah Rowe --- util/libreboot-utils/include/common.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'util/libreboot-utils/include') diff --git a/util/libreboot-utils/include/common.h b/util/libreboot-utils/include/common.h index da102f05..74620ca6 100644 --- a/util/libreboot-utils/include/common.h +++ b/util/libreboot-utils/include/common.h @@ -372,6 +372,8 @@ void write_mac_part(size_t partnum); /* string functions */ +size_t page_remain(const void *p); +long pagesize(void); int xunveilx(const char *path, const char *permissions); int xpledgex(const char *promises, const char *execpromises); char *smalloc(char **buf, size_t size); @@ -381,6 +383,8 @@ int slen(const char *scmp, size_t maxlen, int vcmp(const void *s1, const void *s2, size_t n); int scmp(const char *a, const char *b, size_t maxlen, int *rval); +int ccmp(const char *a, const char *b, size_t i, + int *rval); int sdup(const char *s, size_t n, char **dest); int scatn(ssize_t sc, const char **sv, -- cgit v1.2.1