diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2018-09-07 03:01:38 +0200 |
---|---|---|
committer | Neels Hofmeyr <neels@hofmeyr.de> | 2018-09-07 04:28:39 +0200 |
commit | 7c749893bfcf9f1a117ee6a2d35a6c8f0f05909d (patch) | |
tree | ae4fcbbf59833774221e6f6bf5fb5602b24da7c5 /tests/timer/clk_override_test.c | |
parent | 03e7553cba06145004748aba597636c5342ef89e (diff) |
add osmo_str_tolower() and _toupper() with test
We already have osmo_str2lower() and osmo_str2upper(), but these lack:
* proper destination buffer bounds checking,
* ability to call directly as printf() argument.
Deprecate osmo_str2upper() and osmo_str2lower() because of missing bounds
checking.
Introduce osmo_str_tolower_buf(), osmo_str_toupper_buf() to provide
bounds-safe conversion, also able to safely convert a buffer in-place.
Introduce osmo_str_tolower(), osmo_str_toupper() that call the above _buf()
equivalents using a static buffer[128] and returning the resulting string
directly, convenient for direct printing. Possibly truncated but always safe.
Add unit tests to utils_test.c.
Replace all libosmocore uses of now deprecated osmo_str2lower().
Naming: the ctype.h API is called tolower() and toupper(), so just prepend
'osmo_str_' and don't separate 'to_lower'.
Change-Id: Ib0ee1206b9f31d7ba25c31f8008119ac55440797
Diffstat (limited to 'tests/timer/clk_override_test.c')
0 files changed, 0 insertions, 0 deletions