[Asterisk-code-review] various: Fix GCC 11.2 compilation issues. (asterisk[16])

Friendly Automation asteriskteam at digium.com
Mon Nov 1 09:16:37 CDT 2021


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/16658 )

Change subject: various: Fix GCC 11.2 compilation issues.
......................................................................

various: Fix GCC 11.2 compilation issues.

* Initialize some variables that are never used anyway.

* Use valid pointers instead of integers cast to void pointers when
  calling pthread_setspecific().

ASTERISK-29711 #close
ASTERISK-29713 #close

Change-Id: I8728cd6f2f4b28e0e48113c5da450b768c2a6683
---
M main/channel.c
M main/logger.c
M utils/extconf.c
3 files changed, 4 insertions(+), 4 deletions(-)

Approvals:
  Benjamin Keith Ford: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/main/channel.c b/main/channel.c
index c0e1686..419acb9 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -10344,7 +10344,7 @@
 	int status;
 
 	status = ast_threadstorage_set_ptr(&in_intercept_routine,
-		in_intercept_mode ? (void *) 1 : (void *) 0);
+		in_intercept_mode ? &(int) { 1 } : NULL);
 	if (status) {
 		ast_log(LOG_ERROR, "Failed to set dialplan intercept mode\n");
 	}
diff --git a/main/logger.c b/main/logger.c
index 6b0e76f..126a74d 100644
--- a/main/logger.c
+++ b/main/logger.c
@@ -2213,7 +2213,7 @@
 		return;
 	}
 
-	if (ast_threadstorage_set_ptr(&in_safe_log, (void*)1)) {
+	if (ast_threadstorage_set_ptr(&in_safe_log, &(int) { 1 })) {
 		/* We've failed to set the flag that protects against
 		 * recursion, so bail. */
 		return;
diff --git a/utils/extconf.c b/utils/extconf.c
index afc893c..2da33a8 100644
--- a/utils/extconf.c
+++ b/utils/extconf.c
@@ -2863,8 +2863,8 @@
 
 static struct ast_config *ast_config_internal_load(const char *filename, struct ast_config *cfg, int withcomments, const char *suggested_incl_file)
 {
-	char db[256];
-	char table[256];
+	char db[256] = "";
+	char table[256] = "";
 	struct ast_config_engine *loader = &text_file_engine;
 	struct ast_config *result;
 

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

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I8728cd6f2f4b28e0e48113c5da450b768c2a6683
Gerrit-Change-Number: 16658
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean at seanbright.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20211101/1cf5acde/attachment.html>


More information about the asterisk-code-review mailing list