summaryrefslogtreecommitdiff
path: root/util/libreboot-utils/include/common.h
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-30 05:13:31 +0100
committerLeah Rowe <leah@libreboot.org>2026-03-30 06:25:52 +0100
commitda20b75beac750bf936c9c959f18bf4dce4bdf11 (patch)
tree4a663207cdd150abca2e87c101fa58dd8b58272c /util/libreboot-utils/include/common.h
parentb96708bd3abc3cca7894b96a22caf6291b0748b0 (diff)
libreboot-utils: more flexible string usage
i previously used error status and set return values indirectly. i still do that, but where possible, i also now return the real value. this is because these string functions can no longer return with error status; on error, they all abort. this forces the program maintainer to keep their code reliable, and removes the need to check the error status after using syscalls, because these libc wrappers mitigate that and make use of libc for you, including errors. this is part of a general effort to promote safe use of the C programming language, especially in libreboot! 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.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/util/libreboot-utils/include/common.h b/util/libreboot-utils/include/common.h
index 74620ca6..8276d6da 100644
--- a/util/libreboot-utils/include/common.h
+++ b/util/libreboot-utils/include/common.h
@@ -378,20 +378,20 @@ int xunveilx(const char *path, const char *permissions);
int xpledgex(const char *promises, const char *execpromises);
char *smalloc(char **buf, size_t size);
void *vmalloc(void **buf, size_t size);
-int slen(const char *scmp, size_t maxlen,
+size_t slen(const char *scmp, size_t maxlen,
size_t *rval);
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,
+char *sdup(const char *s,
size_t n, char **dest);
-int scatn(ssize_t sc, const char **sv,
+char *scatn(ssize_t sc, const char **sv,
size_t max, char **rval);
-int scat(const char *s1, const char *s2,
+char *scat(const char *s1, const char *s2,
size_t n, char **dest);
-int dcat(const char *s, size_t n,
+void dcat(const char *s, size_t n,
size_t off, char **dest1,
char **dest2);
/* numerical functions