[Asterisk-code-review] loader.c: Minor module key check simplification. (asterisk[20])

Friendly Automation asteriskteam at digium.com
Mon Apr 3 07:57:38 CDT 2023


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

Change subject: loader.c: Minor module key check simplification.
......................................................................

loader.c: Minor module key check simplification.

Change-Id: I65aefd4434a783096165c179b5f94f2e4810dffe
---
M main/loader.c
1 file changed, 10 insertions(+), 11 deletions(-)

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




diff --git a/main/loader.c b/main/loader.c
index 208e5a2..1c06d6e 100644
--- a/main/loader.c
+++ b/main/loader.c
@@ -885,17 +885,7 @@
 	return 0;
 }
 
-static int key_matches(const unsigned char *key1, const unsigned char *key2)
-{
-	int x;
-
-	for (x = 0; x < 16; x++) {
-		if (key1[x] != key2[x])
-			return 0;
-	}
-
-	return 1;
-}
+#define key_matches(a, b) (memcmp((a), (b), 16) == 0)
 
 static int verify_key(const unsigned char *key)
 {

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

Gerrit-Project: asterisk
Gerrit-Branch: 20
Gerrit-Change-Id: I65aefd4434a783096165c179b5f94f2e4810dffe
Gerrit-Change-Number: 20013
Gerrit-PatchSet: 2
Gerrit-Owner: Sean Bright <sean at seanbright.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: N A <asterisk at phreaknet.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20230403/6694c188/attachment.html>


More information about the asterisk-code-review mailing list