* slang/slmisc.c: Import SLmake_string() and SLmake_nstring().

This commit is contained in:
Pavel Tsekov 2006-02-20 09:20:09 +00:00
parent 199cc08828
commit 71268714c0
2 changed files with 23 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2006-02-20 Pavel Tsekov <ptsekov@gmx.net>
* slmisc.c: Import SLmake_string() and SLmake_nstring().
2006-02-15 Leonard den Ottolander <leonard den ottolander nl>
* slcommon.c: Patch to slang-2.0.6 leaving local patches intact.

View File

@ -29,6 +29,25 @@ USA.
#include "slang.h"
#include "_slang.h"
char *SLmake_string(char *str)
{
return SLmake_nstring(str, strlen (str));
}
char *SLmake_nstring (char *str, unsigned int n)
{
char *ptr;
if (NULL == (ptr = SLmalloc(n + 1)))
{
return NULL;
}
SLMEMCPY (ptr, str, n);
ptr[n] = 0;
return(ptr);
}
/*
* This function assumes that the initial \ char has been removed.
*/