2010-08-08 10:06:34 +02:00
|
|
|
#ifndef UTIL_BSDSTRING_H
|
|
|
|
#define UTIL_BSDSTRING_H
|
|
|
|
|
2012-06-03 20:59:21 +02:00
|
|
|
#include <stddef.h>
|
2012-05-29 19:45:46 +02:00
|
|
|
|
2017-12-11 19:31:42 +01:00
|
|
|
int wrptr(char **ptr, size_t * size, int bytes);
|
2015-08-17 19:28:05 +02:00
|
|
|
char * strlcpy_w(char *dst, const char *src, size_t *siz, const char *err, const char *file, int line);
|
2010-08-08 10:06:34 +02:00
|
|
|
|
2017-12-30 19:49:21 +01:00
|
|
|
#define BUFFER_STRCAT(bufp, size, bytes) if (wrptr(&bufp, &size, bytes) != 0) log_warning("static buffer too small in %s:%d\n", __FILE__, __LINE__);
|
|
|
|
|
2012-05-29 19:45:46 +02:00
|
|
|
#define WARN_STATIC_BUFFER() log_warning("static buffer too small in %s:%d\n", __FILE__, __LINE__)
|
2015-07-08 18:27:27 +02:00
|
|
|
#define INFO_STATIC_BUFFER() log_info("static buffer too small in %s:%d\n", __FILE__, __LINE__)
|
2015-08-17 22:48:21 +02:00
|
|
|
#define STRLCPY(dst, src, siz) strlcpy_w((dst), (src), &(siz), 0, __FILE__, __LINE__)
|
|
|
|
#define STRLCPY_EX(dst, src, siz, err) strlcpy_w((dst), (src), (siz), (err), __FILE__, __LINE__)
|
2012-05-29 19:45:46 +02:00
|
|
|
|
2010-08-08 10:06:34 +02:00
|
|
|
#endif
|