MCPcopy Index your code
hub / github.com/RsyncProject/rsync / my_alloc

Function my_alloc

util2.c:73–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73void *my_alloc(void *ptr, size_t num, size_t size, const char *file, int line)
74{
75 if (num >= max_alloc/size) {
76 if (!file)
77 return NULL;
78 rprintf(FERROR, "[%s] exceeded --max-alloc=%s setting (file=%s, line=%d)\n",
79 who_am_i(), do_big_num(max_alloc, 0, NULL), src_file(file), line);
80 exit_cleanup(RERR_MALLOC);
81 }
82 if (!ptr)
83 ptr = malloc(num * size);
84 else if (ptr == do_calloc)
85 ptr = calloc(num, size);
86 else
87 ptr = realloc(ptr, num * size);
88 if (!ptr && file)
89 _out_of_memory("my_alloc caller", file, line);
90 return ptr;
91}
92
93const char *sum_as_hex(int csum_type, const char *sum, int flist_csum)
94{

Callers 1

my_strdupFunction · 0.85

Calls 5

do_big_numFunction · 0.85
src_fileFunction · 0.85
_out_of_memoryFunction · 0.85
rprintfFunction · 0.70
who_am_iFunction · 0.70

Tested by

no test coverage detected