[Openvpn-devel] [S] Change in openvpn[master]: otime: Remove openvpn_time()

"flichtenheld \(Code Review\) via Openvpn-devel" <[email protected]>
Newsgroups net.sourceforge.lists.openvpn-devel
Message-ID <[email protected]>
Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1841?usp=email

to review the following change.


Change subject: otime: Remove openvpn_time()
......................................................................

otime: Remove openvpn_time()

Using this function seems to be more complicated
than just using now directly.

Suggested by Arne in review of cppcheck fixes.

Change-Id: I2bd5259de702fce5d4ef6926c1dee7c6e6e597d7
Signed-off-by: Frank Lichtenheld <[email protected]>
---
M src/openvpn/otime.h
M src/openvpn/pkcs11.c
M src/openvpn/push.c
3 files changed, 3 insertions(+), 15 deletions(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/41/1841/1

diff --git a/src/openvpn/otime.h b/src/openvpn/otime.h
index f02cc31..d14f01e 100644
--- a/src/openvpn/otime.h
+++ b/src/openvpn/otime.h
@@ -93,17 +93,6 @@
 #endif
 }
 
-static inline time_t
-openvpn_time(time_t *t)
-{
-    update_time();
-    if (t)
-    {
-        *t = now;
-    }
-    return now;
-}
-
 static inline void
 tv_clear(struct timeval *tv)
 {
diff --git a/src/openvpn/pkcs11.c b/src/openvpn/pkcs11.c
index cfcd372..8b06fd0 100644
--- a/src/openvpn/pkcs11.c
+++ b/src/openvpn/pkcs11.c
@@ -42,7 +42,8 @@
 static time_t
 __mytime(void)
 {
-    return openvpn_time(NULL);
+    update_time();
+    return now;
 }
 
 #if !defined(_WIN32)
diff --git a/src/openvpn/push.c b/src/openvpn/push.c
index ce2baf2..97f352e 100644
--- a/src/openvpn/push.c
+++ b/src/openvpn/push.c
@@ -999,9 +999,7 @@
     else if (tls_authentication_status(c->c2.tls_multi) == TLS_AUTHENTICATION_SUCCEEDED
              && c->c2.tls_multi->multi_state >= CAS_CONNECT_DONE)
     {
-        time_t now;
-
-        openvpn_time(&now);
+        update_time();
         if (c->c2.sent_push_reply_expiry > now)
         {
             ret = PUSH_MSG_ALREADY_REPLIED;

-- 
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1841?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2bd5259de702fce5d4ef6926c1dee7c6e6e597d7
Gerrit-Change-Number: 1841
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]>
Gerrit-Reviewer: plaisthos <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.