|
version 1.1, 2012/02/21 23:32:47
|
version 1.1.1.3, 2021/03/17 00:39:23
|
|
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)); |
|
Line 299 mbsplit(Mbuf bp, int cnt)
|
Line 313 mbsplit(Mbuf bp, int cnt)
|
| if (!bp) |
if (!bp) |
| return (NULL); |
return (NULL); |
| |
|
| if (MBLEN(bp) <= cnt) | if ((int)MBLEN(bp) <= cnt) |
| return (NULL); |
return (NULL); |
| |
|
| nbp = mballoc(bp->cnt - cnt); |
nbp = mballoc(bp->cnt - cnt); |
|
Line 315 mbsplit(Mbuf bp, int cnt)
|
Line 329 mbsplit(Mbuf bp, int cnt)
|
| */ |
*/ |
| |
|
| int |
int |
| MemStat(Context ctx, int ac, char *av[], void *arg) | MemStat(Context ctx, int ac, const char *const av[], const void *arg) |
| { |
{ |
| struct typed_mem_stats stats; |
struct typed_mem_stats stats; |
| u_int i; |
u_int i; |
| u_int total_allocs = 0; |
u_int total_allocs = 0; |
| u_int total_bytes = 0; |
u_int total_bytes = 0; |
| |
|
| |
(void)ac; |
| |
(void)av; |
| |
(void)arg; |
| |
|
| if (typed_mem_usage(&stats)) |
if (typed_mem_usage(&stats)) |
| Error("typed_mem_usage() error"); |
Error("typed_mem_usage() error"); |