From 06356fd9c3234574bd26d2f123acd334b4275f3c Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Tue, 19 Nov 2019 01:38:10 +0100 Subject: utils: add osmo_strnchr() When finding a char in a string, I want to be able to limit the search area by size, not only by nul terminator. Change-Id: I48f8ace9f51f8a06796648883afcabe3b4e8b537 --- include/osmocom/core/utils.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/osmocom/core/utils.h b/include/osmocom/core/utils.h index 86d45bcc..1abbe989 100644 --- a/include/osmocom/core/utils.h +++ b/include/osmocom/core/utils.h @@ -139,6 +139,7 @@ uint64_t osmo_decode_big_endian(const uint8_t *data, size_t data_len); uint8_t *osmo_encode_big_endian(uint64_t value, size_t data_len); size_t osmo_strlcpy(char *dst, const char *src, size_t siz); +const char *osmo_strnchr(const char *str, size_t str_size, char c); bool osmo_is_hexstr(const char *str, int min_digits, int max_digits, bool require_even); -- cgit v1.2.3