mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 22:03:31 +01:00
Add tor_realloc to mirror tor_malloc
svn:r582
This commit is contained in:
parent
6115813de3
commit
77be56fbdd
@ -25,6 +25,17 @@ void *tor_malloc(size_t size) {
|
||||
return result;
|
||||
}
|
||||
|
||||
void *tor_realloc(void *ptr, size_t size) {
|
||||
void *result;
|
||||
|
||||
result = realloc(ptr, size);
|
||||
if (!result) {
|
||||
log_fn(LOG_ERR, "Out of memory. Dying.");
|
||||
exit(1);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
char *tor_strdup(const char *s) {
|
||||
char *dup;
|
||||
assert(s);
|
||||
|
@ -34,6 +34,7 @@
|
||||
|
||||
#define xfree(p) do {if(p) {free(p); (p)=NULL;}} while(0) /* XXX use everywhere? */
|
||||
void *tor_malloc(size_t size);
|
||||
void *tor_realloc(void *ptr, size_t size);
|
||||
char *tor_strdup(const char *s);
|
||||
void tor_gettimeofday(struct timeval *timeval);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user