[Openvpn-devel] ssl.c: use arrow operator to access object member

Message ID 20220110144510.17769-1-a@unstable.cc
State Accepted
Headers show
Series [Openvpn-devel] ssl.c: use arrow operator to access object member | expand

Commit Message

Antonio Quartulli Jan. 10, 2022, 3:45 a.m. UTC
The arrow operator exists exactly to perform a pointer dereference implicitly
while accessing a member.

while at it, add whitespaces around the '-' operator on the same line.

Signed-off-by: Antonio Quartulli <a@unstable.cc>
---
 src/openvpn/ssl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Gert Doering Jan. 14, 2022, 2:27 a.m. UTC | #1
Acked-by: Gert Doering <gert@greenie.muc.de>

Both is technically doing the same thing, but we use -> notation in 
most places, so this is more consistent.  Client-side tested.

(JFTR, the offending commit is 15d052432, which moved from "structure
access" to "pointer access", so going from "key2." to "(*key2)." is
understandable...)

Your patch has been applied to the master branch.

commit eb3e849e63e32cc015aa21c4481b232bf69c8976
Author: Antonio Quartulli
Date:   Mon Jan 10 15:45:10 2022 +0100

     ssl.c: use arrow operator to access object member

     Signed-off-by: Antonio Quartulli <a@unstable.cc>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20220110144510.17769-1-a@unstable.cc>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23521.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c
index 400b2062..ef3597af 100644
--- a/src/openvpn/ssl.c
+++ b/src/openvpn/ssl.c
@@ -1669,9 +1669,9 @@  init_key_contexts(struct key_ctx_bi *key,
     init_key_ctx_bi(key, key2, key_direction, key_type, "Data Channel");
 
     /* Initialize implicit IVs */
-    key_ctx_update_implicit_iv(&key->encrypt, (*key2).keys[(int)server].hmac,
+    key_ctx_update_implicit_iv(&key->encrypt, key2->keys[(int)server].hmac,
                                MAX_HMAC_KEY_LENGTH);
-    key_ctx_update_implicit_iv(&key->decrypt, (*key2).keys[1-(int)server].hmac,
+    key_ctx_update_implicit_iv(&key->decrypt, key2->keys[1 - (int)server].hmac,
                                MAX_HMAC_KEY_LENGTH);
 
 }