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/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/15024 Change subject: utils: share static buffer in osmo_str_to{lower,upper}() ...................................................................... utils: share static buffer in osmo_str_to{lower,upper}() Change-Id: I032803faa0e27c2efdff1ff276acabab95a8319a --- M src/utils.c 1 file changed, 8 insertions(+), 8 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/24/15024/1 diff --git a/src/utils.c b/src/utils.c index 7364bfb..ea1de0f 100644 --- a/src/utils.c +++ b/src/utils.c @@ -42,6 +42,8 @@ * \file utils.c */ static __thread char namebuf[255]; +/* shared by osmo_str_tolower() and osmo_str_toupper() */ +static __thread char capsbuf[128]; /*! get human-readable string for given value * \param[in] vs Array of value_string tuples @@ -901,16 +903,15 @@ /*! Convert a string to lowercase, using a static buffer. * The resulting string may be truncated if the internally used static buffer is shorter than src. * The internal buffer is at least 128 bytes long, i.e. guaranteed to hold at least 127 characters and a - * terminating nul. + * terminating nul. The static buffer returned is shared with osmo_str_toupper(). * See also osmo_str_tolower_buf(). * \param[in] src String to convert to lowercase. * \returns Resulting lowercase string in a static buffer, always nul terminated. */ const char *osmo_str_tolower(const char *src) { - static __thread char buf[128]; - osmo_str_tolower_buf(buf, sizeof(buf), src); - return buf; + osmo_str_tolower_buf(capsbuf, sizeof(capsbuf), src); + return capsbuf; } /*! Convert a string to lowercase, dynamically allocating the output from given talloc context @@ -960,16 +961,15 @@ /*! Convert a string to uppercase, using a static buffer. * The resulting string may be truncated if the internally used static buffer is shorter than src. * The internal buffer is at least 128 bytes long, i.e. guaranteed to hold at least 127 characters and a - * terminating nul. + * terminating nul. The static buffer returned is shared with osmo_str_tolower(). * See also osmo_str_toupper_buf(). * \param[in] src String to convert to uppercase. * \returns Resulting uppercase string in a static buffer, always nul terminated. */ const char *osmo_str_toupper(const char *src) { - static __thread char buf[128]; - osmo_str_toupper_buf(buf, sizeof(buf), src); - return buf; + osmo_str_toupper_buf(capsbuf, sizeof(capsbuf), src); + return capsbuf; } /*! Convert a string to uppercase, dynamically allocating the output from given talloc context -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/15024 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I032803faa0e27c2efdff1ff276acabab95a8319a Gerrit-Change-Number: 15024 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190801/5f70c3b4/attachment.htm>