[Pkg-gnupg-commit] [gnupg2] 67/205: gpg: Avoid an unnecessary copy.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed May 11 08:38:18 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch experimental
in repository gnupg2.

commit 512bc72e1f8544341529174142273d857f45540c
Author: Neal H. Walfield <neal at g10code.com>
Date:   Thu Feb 25 14:51:55 2016 +0100

    gpg: Avoid an unnecessary copy.
    
    * g10/build-packet.c (sig_to_notation): Avoid an unnecessary copy of
    the data: the size of the packet is fixed.
    
    --
    Signed-off-by: Neal H. Walfield <neal at g10code.com>
---
 g10/build-packet.c | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/g10/build-packet.c b/g10/build-packet.c
index a6d5881..c821ed6 100644
--- a/g10/build-packet.c
+++ b/g10/build-packet.c
@@ -1166,22 +1166,17 @@ do_signature( IOBUF out, int ctb, PKT_signature *sig )
 static int
 do_onepass_sig( IOBUF out, int ctb, PKT_onepass_sig *ops )
 {
-    int rc = 0;
-    IOBUF a = iobuf_temp();
+    write_header(out, ctb, 4 + 8 + 1);
 
-    iobuf_put (a, 3);  /* Version.  */
-    iobuf_put(a, ops->sig_class );
-    iobuf_put(a, ops->digest_algo );
-    iobuf_put(a, ops->pubkey_algo );
-    write_32(a, ops->keyid[0] );
-    write_32(a, ops->keyid[1] );
-    iobuf_put(a, ops->last );
-
-    write_header(out, ctb, iobuf_get_temp_length(a) );
-    rc = iobuf_write_temp( out, a );
+    iobuf_put (out, 3);  /* Version.  */
+    iobuf_put(out, ops->sig_class );
+    iobuf_put(out, ops->digest_algo );
+    iobuf_put(out, ops->pubkey_algo );
+    write_32(out, ops->keyid[0] );
+    write_32(out, ops->keyid[1] );
+    iobuf_put(out, ops->last );
 
-    iobuf_close(a);
-    return rc;
+    return 0;
 }
 
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list