73 void *
new(
size_t size)
82 if( (p = malloc(size)) ==
NULL )
84 fprintf(stderr,
"new(): malloc() failed\n");
112 void *
new_overs(
void *pSrc,
size_t sizeDup,
size_t sizeNew)
116 if( sizeDup > sizeNew )
118 fprintf(stderr,
"new_overs(): duplicate size %lu > allocated size %lu\n",
119 (
unsigned long)sizeDup, (
unsigned long)sizeNew);
127 memcpy(pNew, pSrc, sizeDup);
150 if( (size == 0) || (data ==
NULL) )
152 p = (
void *)
new((
size_t)1);
153 memset(p, 0, (
size_t)1);
158 memcpy(p, data, size);
180 if( (s !=
NULL) && (*s != 0) )
212 if( (s !=
NULL) && (*s != 0) && (n > 0) )
#define NEWSTR(len)
Allocate new string buffer of length len+1.
Memory allocation and deallocation declarations.
char * new_strndup(const char *s, size_t n)
Duplicate not more than n characters of string.
void * new_overs(void *pSrc, size_t sizeDup, size_t sizeNew)
Allocate and duplicate.
RoadNarrows Robotics common configuration file.
char * new_strdup(const char *s)
Duplicate a string.
#define EC_ERROR
general error exit code
void * new_memdup(size_t size, void *data)
Duplicate data.