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:
parent
178b3772ff
commit
6fa1808cb7
2 changed files with 19 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue