[gnutls-devel] [PATCH 2/4] Optimized calls to _gnutls_buffer_append_data with data_size of 0.

Jaak Ristioja jaak.ristioja at cyber.ee
Wed Dec 17 12:55:08 CET 2014


Signed-off-by: Jaak Ristioja <jaak.ristioja at cyber.ee>
---
 lib/gnutls_str.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/gnutls_str.c b/lib/gnutls_str.c
index 06141f4..6cfbbb6 100644
--- a/lib/gnutls_str.c
+++ b/lib/gnutls_str.c
@@ -117,11 +117,10 @@ int
 _gnutls_buffer_append_data(gnutls_buffer_st * dest, const void *data,
 			   size_t data_size)
 {
-	size_t const tot_len = data_size + dest->length;
-
 	if (data_size == 0)
 		return 0;
 
+	size_t const tot_len = data_size + dest->length;
 	if (dest->max_length >= tot_len) {
 		size_t const unused = MEMSUB(dest->data, dest->allocd);
 
-- 
2.2.0




More information about the Gnutls-devel mailing list