Change in libosmocore[master]: add osmo_str_tolower() and _toupper() with test

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Fri Sep 7 02:18:43 UTC 2018


Hello Jenkins Builder, 

I'd like you to reexamine a change. Please visit

    https://gerrit.osmocom.org/10830

to look at the new patch set (#2).

Change subject: add osmo_str_tolower() and _toupper() with test
......................................................................

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() and
osmo_str2upper().

Naming: the ctype.h API is called tolower() and toupper(), so just prepend
'osmo_str_' and don't separate 'to_lower'.

Change-Id: Ib0ee1206b9f31d7ba25c31f8008119ac55440797
---
M include/osmocom/core/utils.h
M src/utils.c
M src/vty/logging_vty.c
M tests/utils/utils_test.c
M tests/utils/utils_test.ok
5 files changed, 332 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/30/10830/2
-- 
To view, visit https://gerrit.osmocom.org/10830
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ib0ee1206b9f31d7ba25c31f8008119ac55440797
Gerrit-Change-Number: 10830
Gerrit-PatchSet: 2
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180907/bebda5e8/attachment.htm>


More information about the gerrit-log mailing list