Attention is currently required from: Arne Schwabe.

Hello Arne Schwabe,

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

    https://gerrit.openvpn.net/c/openvpn/+/2132?usp=email

to review the following change.


Change subject: push_util: use string_alloc() instead of a local gc_strdup()
......................................................................

push_util: use string_alloc() instead of a local gc_strdup()

gc_strdup() duplicated string_alloc() for its only caller. While here,
fix the typos in the message_splitter() comment.

Change-Id: Ib33ce23448959673affdfd462b4c2cfa9a015f55
Signed-off-by: Razvan Cojocaru <[email protected]>
---
M src/openvpn/push_util.c
1 file changed, 3 insertions(+), 12 deletions(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/32/2132/1

diff --git a/src/openvpn/push_util.c b/src/openvpn/push_util.c
index 34cb26c..0c27575 100644
--- a/src/openvpn/push_util.c
+++ b/src/openvpn/push_util.c
@@ -78,17 +78,8 @@
     return buf;
 }

-static char *
-gc_strdup(const char *src, struct gc_arena *gc)
-{
-    char *ret = gc_malloc((strlen(src) + 1) * sizeof(char), true, gc);
-
-    strcpy(ret, src);
-    return ret;
-}
-
-/* It split the messagge (if necessary) and fill msgs with the message chunks.
- * Return `false` on failure an `true` on success.
+/* Split the message (if necessary) and fill msgs with the message chunks.
+ * Return `false` on failure and `true` on success.
  */
 static bool
 message_splitter(const char *s, struct buffer_list *msgs, struct gc_arena *gc, 
const size_t safe_cap)
@@ -98,7 +89,7 @@
         return false;
     }

-    char *str = gc_strdup(s, gc);
+    char *str = string_alloc(s, gc);

     while (*str)
     {

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

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib33ce23448959673affdfd462b4c2cfa9a015f55
Gerrit-Change-Number: 2132
Gerrit-PatchSet: 1
Gerrit-Owner: Răzvan Cojocaru <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Arne Schwabe <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to