summaryrefslogtreecommitdiff
path: root/util/libreboot-utils/include/common.h
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-30 00:35:56 +0100
committerLeah Rowe <leah@libreboot.org>2026-03-30 01:53:17 +0100
commit9d4302deb237d0b65696ded4924206626e4dd997 (patch)
treedf9d2faa82272bec6abb7c10424660625db90126 /util/libreboot-utils/include/common.h
parent7fb0b2f69293f0fb0e83e9b125fbd658503147f0 (diff)
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 <leah@libreboot.org>
Diffstat (limited to 'util/libreboot-utils/include/common.h')
-rw-r--r--util/libreboot-utils/include/common.h4
1 files changed, 4 insertions, 0 deletions
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,