version 1.1, 2012/02/21 23:32:47
|
version 1.1.1.2, 2019/10/22 13:49:55
|
Line 55 Mdup(const char *type, const void *src, size_t size)
|
Line 55 Mdup(const char *type, const void *src, size_t size)
|
} |
} |
|
|
void * |
void * |
|
Mdup2(const char *type, const void *src, size_t oldsize, size_t newsize) |
|
{ |
|
const char **memory; |
|
if ((memory = MALLOC(type, sizeof(char *) + newsize)) == NULL) { |
|
Perror("Mdup2: malloc"); |
|
DoExit(EX_ERRDEAD); |
|
} |
|
|
|
memory[0] = type; |
|
memcpy(memory + 1, src, oldsize < newsize ? oldsize : newsize); |
|
return(memory + 1); |
|
} |
|
|
|
void * |
Mstrdup(const char *type, const void *src) |
Mstrdup(const char *type, const void *src) |
{ |
{ |
return (Mdup(type, src, strlen(src) + 1)); |
return (Mdup(type, src, strlen(src) + 1)); |