diff options
Diffstat (limited to 'xstd.c')
-rw-r--r-- | xstd.c | 16 |
1 files changed, 5 insertions, 11 deletions
@@ -23,12 +23,16 @@ #include "private.h" +/* + * Contains wrappers for common functions to simplify their general + * usage throughout this codebase. + */ + #ifdef __linux__ extern size_t strlcat(char *, const char *, size_t); extern size_t strlcpy(char *, const char *, size_t); #endif - int xstrcmp(const char *p1, const char *p2) { @@ -36,7 +40,6 @@ xstrcmp(const char *p1, const char *p2) return(0 == strcmp(p1, p2)); } - int xstrlcat(char *dst, const char *src, size_t sz) { @@ -44,7 +47,6 @@ xstrlcat(char *dst, const char *src, size_t sz) return(strlcat(dst, src, sz) < sz); } - int xstrlcpy(char *dst, const char *src, size_t sz) { @@ -52,8 +54,6 @@ xstrlcpy(char *dst, const char *src, size_t sz) return(strlcpy(dst, src, sz) < sz); } - - void * xcalloc(size_t num, size_t sz) { @@ -64,7 +64,6 @@ xcalloc(size_t num, size_t sz) return(p); } - char * xstrdup(const char *p) { @@ -75,7 +74,6 @@ xstrdup(const char *p) return(pp); } - int xstrlcats(char *buf, const struct mdoc_node *n, size_t sz) { @@ -97,9 +95,6 @@ xstrlcats(char *buf, const struct mdoc_node *n, size_t sz) return(1); } - - - #ifdef __linux__ /* $OpenBSD: strlcat.c,v 1.13 2005/08/08 08:05:37 espie Exp $ */ @@ -151,7 +146,6 @@ strlcat(char *dst, const char *src, size_t siz) return(dlen + (s - src)); /* count does not include NUL */ } - size_t strlcpy(char *dst, const char *src, size_t siz) { |