[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Remove a needless memset() in get_token_arguments()



commit 9dc53bc68f5e038c9531e3b12a58026d4007f652
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Fri Dec 14 14:48:12 2018 -0500

    Remove a needless memset() in get_token_arguments()
    
    I believe we originally added this for "just in case" safety, but it
    isn't actually needed -- we never copy uninitialized stack here.
    What's more, this one memset is showing up on our startup profiles,
    so we ought to remove it.
    
    Closes ticket 28852.
---
 changes/ticket28852                | 4 ++++
 src/feature/dirparse/parsecommon.c | 1 -
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/changes/ticket28852 b/changes/ticket28852
new file mode 100644
index 000000000..a58cc3ba0
--- /dev/null
+++ b/changes/ticket28852
@@ -0,0 +1,4 @@
+  o Minor features (performance):
+    - Remove a needless memset() call from get_token_arguments,
+      thereby speeding up the tokenization of directory objects by about
+      20%. Closes ticket 28852.
diff --git a/src/feature/dirparse/parsecommon.c b/src/feature/dirparse/parsecommon.c
index e00af0eea..5280f2ed2 100644
--- a/src/feature/dirparse/parsecommon.c
+++ b/src/feature/dirparse/parsecommon.c
@@ -169,7 +169,6 @@ get_token_arguments(memarea_t *area, directory_token_t *tok,
   char *cp = mem;
   int j = 0;
   char *args[MAX_ARGS];
-  memset(args, 0, sizeof(args));
   while (*cp) {
     if (j == MAX_ARGS)
       return -1;



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits