[Asterisk-code-review] strings.h: ast_str_to_upper() and _to_lower() are not pure. (asterisk[master])

Joshua Colp asteriskteam at digium.com
Wed Mar 10 04:18:52 CST 2021


Joshua Colp has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/15578 )

Change subject: strings.h: ast_str_to_upper() and _to_lower() are not pure.
......................................................................

strings.h: ast_str_to_upper() and _to_lower() are not pure.

Because they modify their argument they are not pure functions and
should not be marked as such, otherwise the compiler may optimize
them away.

ASTERISK-29306 #close

Change-Id: Ibec03a08522dd39e8a137ece9bc6a3059dfaad5f
---
M include/asterisk/strings.h
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve; Approved for Submit
  George Joseph: Looks good to me, approved



diff --git a/include/asterisk/strings.h b/include/asterisk/strings.h
index e9d786c..929cbf5 100644
--- a/include/asterisk/strings.h
+++ b/include/asterisk/strings.h
@@ -1265,7 +1265,7 @@
  *
  * \retval str for convenience
  */
-static force_inline char *attribute_pure ast_str_to_lower(char *str)
+static force_inline char *ast_str_to_lower(char *str)
 {
 	char *str_orig = str;
 	if (!str) {
@@ -1286,7 +1286,7 @@
  *
  * \retval str for convenience
  */
-static force_inline char *attribute_pure ast_str_to_upper(char *str)
+static force_inline char *ast_str_to_upper(char *str)
 {
 	char *str_orig = str;
 	if (!str) {

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Ibec03a08522dd39e8a137ece9bc6a3059dfaad5f
Gerrit-Change-Number: 15578
Gerrit-PatchSet: 2
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210310/41f444c0/attachment.html>


More information about the asterisk-code-review mailing list