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

Jaak Ristioja jaak.ristioja at cyber.ee
Tue Dec 16 17:18:35 CET 2014


---
 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 13222f0..ca4eec3 100644
--- a/lib/gnutls_str.c
+++ b/lib/gnutls_str.c
@@ -110,11 +110,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