summaryrefslogtreecommitdiffstats
path: root/g10/build-packet.c
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@g10code.com>2016-02-25 14:51:55 +0100
committerNeal H. Walfield <neal@g10code.com>2016-02-25 14:51:55 +0100
commit512bc72e1f8544341529174142273d857f45540c (patch)
tree77ff62de3de926f38401c024d746658ea6708fe1 /g10/build-packet.c
parentcommon: Reduce buffer size. (diff)
downloadgnupg2-512bc72e1f8544341529174142273d857f45540c.tar.xz
gnupg2-512bc72e1f8544341529174142273d857f45540c.zip
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@g10code.com>
Diffstat (limited to 'g10/build-packet.c')
-rw-r--r--g10/build-packet.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/g10/build-packet.c b/g10/build-packet.c
index a6d588115..c821ed69e 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;
}