mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-30 08:34:16 +01:00
trivial optimization: add 1 only once
This commit is contained in:
parent
d66c27cd35
commit
995192ad56
1 changed files with 3 additions and 3 deletions
|
@ -142,10 +142,10 @@ copyString( MPFORMAL const XP_UCHAR* instr )
|
||||||
{
|
{
|
||||||
XP_UCHAR* result = (XP_UCHAR*)NULL;
|
XP_UCHAR* result = (XP_UCHAR*)NULL;
|
||||||
if ( !!instr ) {
|
if ( !!instr ) {
|
||||||
XP_U16 len = XP_STRLEN( (const char*)instr );
|
XP_U16 len = 1 + XP_STRLEN( (const char*)instr );
|
||||||
result = (XP_UCHAR*)XP_MALLOC( (MemPoolCtx*)mpool, len + 1 );
|
result = (XP_UCHAR*)XP_MALLOC( (MemPoolCtx*)mpool, len );
|
||||||
XP_ASSERT( !!result );
|
XP_ASSERT( !!result );
|
||||||
XP_MEMCPY( result, instr, len + 1);
|
XP_MEMCPY( result, instr, len );
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
} /* copyString */
|
} /* copyString */
|
||||||
|
|
Loading…
Add table
Reference in a new issue