1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

common: Add xreallocarray function.

* common/miscellaneous.c (xreallocarray): New func.
* common/util.h (xtryreallocarray): New macro.
--

Very useful to match calloc behaviour.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2020-03-04 13:55:53 +01:00
parent 178b3772ff
commit 6fa1808cb7
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
2 changed files with 19 additions and 0 deletions

View file

@ -117,6 +117,17 @@ xoutofcore (void)
}
/* Wrapper around gpgrt_reallocarray. */
void *
xreallocarray (void *a, size_t oldnmemb, size_t nmemb, size_t size)
{
void *p = gpgrt_reallocarray (a, oldnmemb, nmemb, size);
if (!p)
xoutofcore ();
return p;
}
/* A wrapper around gcry_cipher_algo_name to return the string
"AES-128" instead of "AES". Given that we have an alias in
libgcrypt for it, it does not harm to too much to return this other