From ff65d24ec4cac038e07a16692c3ae64d6e5fbc3c Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Tue, 19 Nov 2019 00:21:14 +0100 Subject: utils_test: add osmo_print_n_test() A couple of times recently I've needed to copy out a substring to a buffer with limited size. Use of strncpy() or osmo_strlcpy() are nontrivial here. I wanted to have a dedicated function. After I wrote that function with a test, I noticed that I had already implemented the same thing a while ago, as osmo_print_n() :P So here is just the test. Change-Id: Ia716abdc1f58af6065b84f4f567388a32a7b39fc --- src/utils.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/utils.c') diff --git a/src/utils.c b/src/utils.c index 904f6e45..4378431b 100644 --- a/src/utils.c +++ b/src/utils.c @@ -509,6 +509,8 @@ uint8_t *osmo_encode_big_endian(uint64_t value, size_t data_len) * Copy at most \a siz bytes from \a src to \a dst, ensuring that the result is * NUL terminated. The NUL character is included in \a siz, i.e. passing the * actual sizeof(*dst) is correct. + * + * Note, a similar function that also limits the input buffer size is osmo_print_n(). */ size_t osmo_strlcpy(char *dst, const char *src, size_t siz) { -- cgit v1.2.3