Change in libosmocore[master]: utils: add osmo_str_to_int() and osmo_str_to_int64()

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 gerrit-no-reply at lists.osmocom.org
Tue Sep 7 12:01:42 UTC 2021


neels has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/25345 )

Change subject: utils: add osmo_str_to_int() and osmo_str_to_int64()
......................................................................


Patch Set 2:

The linter does not like that osmo_str_to_int() sometimes returns a positive errno.

I did that on purpose. Why am I doing this?
There is a difference between exceeding the data type range and exceeding the min_val..max_val range.
If exceeding the min_val..max_val range, the result will still reflect the exact number parsed.
If exceeding the data type range, the result will be clamped to INT_MIN..INT_MAX.

So I thought it is good to distinguish between -ERANGE where our osmo code says "out of range",
and strtoll() ERANGE where the library call says "cannot be parsed because there are too many digits".

Does anyone oppose removing the linter V-1?


-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/25345
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I4dac826aab00bc1780a5258b6b55d34ce7d50c60
Gerrit-Change-Number: 25345
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-Comment-Date: Tue, 07 Sep 2021 12:01:42 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210907/2dde2c39/attachment.htm>


More information about the gerrit-log mailing list