home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.ncftp.com
/
ftp.ncftp.com.zip
/
ftp.ncftp.com
/
libncftp
/
older_versions
/
libncftp-3.2.2-src.tar.bz2
/
libncftp-3.2.2-src.tar
/
libncftp-3.2.2
/
Strn
/
DStrNew.c
< prev
next >
Wrap
C/C++ Source or Header
|
2001-11-19
|
420b
|
24 lines
#include "syshdrs.h"
#ifdef PRAGMA_HDRSTOP
# pragma hdrstop
#endif
int
DStrNew(DStr *const dst, const size_t srcLen)
{
size_t allocSize;
char *cp;
memset(dst, 0, sizeof(DStr));
if (srcLen > 0x00FFFFFF)
return (-1);
allocSize = (srcLen + 16) & 0xFFFFFFF0;
cp = calloc(allocSize, (size_t) 1);
if (cp == NULL)
return (-1);
dst->allocSize = allocSize;
dst->s = cp;
dst->len = 0;
return (0);
} /* DStrNew */