From 995192ad567ba772dcc01c22a60f00a4f77c5a81 Mon Sep 17 00:00:00 2001 From: ehouse Date: Tue, 30 May 2006 04:34:35 +0000 Subject: [PATCH] trivial optimization: add 1 only once --- common/strutils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/strutils.c b/common/strutils.c index 81b77e83c..18dcc0e2b 100644 --- a/common/strutils.c +++ b/common/strutils.c @@ -142,10 +142,10 @@ copyString( MPFORMAL const XP_UCHAR* instr ) { XP_UCHAR* result = (XP_UCHAR*)NULL; if ( !!instr ) { - XP_U16 len = XP_STRLEN( (const char*)instr ); - result = (XP_UCHAR*)XP_MALLOC( (MemPoolCtx*)mpool, len + 1 ); + XP_U16 len = 1 + XP_STRLEN( (const char*)instr ); + result = (XP_UCHAR*)XP_MALLOC( (MemPoolCtx*)mpool, len ); XP_ASSERT( !!result ); - XP_MEMCPY( result, instr, len + 1); + XP_MEMCPY( result, instr, len ); } return result; } /* copyString */