libosmocore/include/osmocom/core
Neels Hofmeyr 7c749893bf 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
2018-09-07 04:28:39 +02:00
..
application.h fix logging talloc ctx: add osmo_init_logging2() 2018-03-28 19:06:16 +02:00
backtrace.h doxygen: unify use of \file across the board 2017-06-23 00:18:23 +00:00
bitXXgen.h.tpl doxygen: enable AUTOBRIEF, drop \brief 2017-06-23 00:18:22 +00:00
bitcomp.h Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
bits.h [doc] bits.c: Better / more Doxygen documentation 2017-10-16 14:19:12 +02:00
bitvec.h Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
byteswap.h fix issue on big endian architecture 2018-04-09 17:32:11 +00:00
conv.h doxygen: unify use of \file across the board 2017-06-23 00:18:23 +00:00
counter.h counters: add osmo_counters_count() returns the amount of counters 2017-12-05 16:06:27 +01:00
crc16.h [doc] Put CRC-16 and generic CRC code in one Doxygen module 2017-10-16 14:29:26 +02:00
crcXXgen.h.tpl [doc] Put CRC-16 and generic CRC code in one Doxygen module 2017-10-16 14:29:26 +02:00
crcgen.h [doc] Put CRC-16 and generic CRC code in one Doxygen module 2017-10-16 14:29:26 +02:00
defs.h doxygen: unify use of \file across the board 2017-06-23 00:18:23 +00:00
endian.h doxygen: unify use of \file across the board 2017-06-23 00:18:23 +00:00
fsm.h use __FILE__, not __BASE_FILE__ 2018-08-20 20:23:18 +00:00
gsmtap.h GSMTAP: add SIM sub_types 2018-07-27 17:19:47 +00:00
gsmtap_util.h gsmtap: Add value_strings for GSMTAP_TYPE and GSMTAP_CHANNEL 2017-07-13 00:03:29 +02:00
isdnhdlc.h isdnhdlc: Port from kernel to userspace 2018-05-11 21:57:46 +02:00
linuxlist.h api doc: fix two doxygen group closing braces 2017-10-17 11:53:45 +00:00
linuxrbtree.h fix FSF address in sources/headers 2015-11-12 13:46:05 +01:00
logging.h Add RSPRO support to IPA and logging definitions 2018-09-03 14:21:54 +02:00
loggingrb.h doxygen: unify use of \file across the board 2017-06-23 00:18:23 +00:00
macaddr.h doxygen: unify use of \file across the board 2017-06-23 00:18:23 +00:00
msgb.h msgb: Introduce msgb_{de,en}queue_count APIs 2018-08-17 10:34:15 +02:00
msgfile.h doxygen: unify use of \file across the board 2017-06-23 00:18:23 +00:00
panic.h osmo_panic(): Annotate as __attribute__ ((noreturn)) 2018-06-29 20:32:57 +02:00
plugin.h doxygen: unify use of \file across the board 2017-06-23 00:18:23 +00:00
prbs.h Add pseudo-random bit sequence generator to libosmcoore 2017-07-10 23:42:02 +02:00
prim.h [doc] Expand Doxuygen documentation for osmo_prim 2017-10-16 14:52:37 +02:00
process.h doxygen: unify use of \file across the board 2017-06-23 00:18:23 +00:00
rate_ctr.h rate_ctr: Add rate_ctr_inc2() as convenience wrapper 2018-02-24 14:46:35 +01:00
select.h Add osmo_timerfd_* functions for osmo_fd-wrapped timerfd 2018-05-10 10:33:54 +02:00
sercomm.h doxygen: unify use of \file across the board 2017-06-23 00:18:23 +00:00
serial.h doxygen: unify use of \file across the board 2017-06-23 00:18:23 +00:00
signal.h signal: Introduce API osmo_signal_talloc_ctx_init 2018-08-16 21:03:32 +02:00
socket.h socket: add flag to enforce SO_REUSEADDR on UDP sockets 2018-08-23 20:17:45 +02:00
stat_item.h [doc] stat_item: Complete doxygen documentation for API 2017-10-16 14:18:50 +02:00
statistics.h Rename 'statistics.c' to 'counter.c' 2017-10-15 19:51:35 +02:00
stats.h Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
strrb.h doxygen: unify use of \file across the board 2017-06-23 00:18:23 +00:00
talloc.h doxygen: unify use of \file across the board 2017-06-23 00:18:23 +00:00
timer.h timer: Introduce osmo_clock_gettime to override clock_gettime 2018-03-01 12:33:02 +00:00
timer_compat.h core: Add timespec helper macros and make timer_compat.h public 2018-02-27 15:44:29 +00:00
utils.h add osmo_str_tolower() and _toupper() with test 2018-09-07 04:28:39 +02:00
write_queue.h control_if: Avoid heap-use-after-free in osmo_wqueue_bfd_cb 2018-05-04 18:29:26 +02:00