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.orgNeels Hofmeyr has uploaded this change for review. ( https://gerrit.osmocom.org/12879 Change subject: get_value_string(): guard against NULL ...................................................................... get_value_string(): guard against NULL get_value_string() conveniently prints the value number to a static buffer if it is unknown in a value_string array. Do the same if the value_string array pointer itself is NULL. To add osmo_use_count API (upcoming patch), I want to use a user supplied value string array, and in its absence would like to just print the user enum value as digits. I could add a separate NULL check around calling get_value_string(), but by making get_value_string() itself guard against NULL, I can avoid defining yet another static char buffer. Change-Id: Ie640e9258a959da8f4f9089478de993509853997 --- M src/utils.c 1 file changed, 3 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/79/12879/1 diff --git a/src/utils.c b/src/utils.c index 0b2ed31..2d5bcb0 100644 --- a/src/utils.c +++ b/src/utils.c @@ -73,6 +73,9 @@ { int i; + if (!vs) + return NULL; + for (i = 0;; i++) { if (vs[i].value == 0 && vs[i].str == NULL) break; -- To view, visit https://gerrit.osmocom.org/12879 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: Ie640e9258a959da8f4f9089478de993509853997 Gerrit-Change-Number: 12879 Gerrit-PatchSet: 1 Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190212/6138ec29/attachment.htm>