mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-02-04 04:50:31 +01:00
boilerplate: Add xrealloc function
This commit is contained in:
parent
1e4515c548
commit
7673e3ac3f
2 changed files with 15 additions and 0 deletions
|
|
@ -56,3 +56,15 @@ xcalloc (size_t nmemb, size_t size)
|
|||
|
||||
return buf;
|
||||
}
|
||||
|
||||
void *
|
||||
xrealloc (void *buf, size_t size)
|
||||
{
|
||||
buf = realloc (buf, size);
|
||||
if (!buf) {
|
||||
CAIRO_BOILERPLATE_LOG ("Error: Out of memory. Exiting\n");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,4 +34,7 @@ xmalloc (size_t size);
|
|||
void *
|
||||
xcalloc (size_t nmemb, size_t size);
|
||||
|
||||
void *
|
||||
xrealloc (void *buf, size_t size);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue