mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-15 17:58:46 +02:00
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>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user