summaryrefslogtreecommitdiff
path: root/contrib/pgcrypto/imath.c
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2020-09-25 10:25:55 +0900
committerMichael Paquier <michael@paquier.xyz>2020-09-25 10:25:55 +0900
commitca7f8e2b86e5f15a40b67e6199d714f45a467ff1 (patch)
tree19c94a35cb8ff4902d4b4f7b477ace69e1d34a33 /contrib/pgcrypto/imath.c
parenta45bc8a4f6495072bc48ad40a5aa0304979114f7 (diff)
Remove custom memory allocation layer in pgcrypto
PX_OWN_ALLOC was intended as a way to disable the use of palloc(), and over the time new palloc() or equivalent calls have been added like in 32984d8, making this extra layer losing its original purpose. This simplifies on the way some code paths to use palloc0() rather than palloc() followed by memset(0). Author: Daniel Gustafsson Discussion: https://postgr.es/m/A5BFAA1A-B2E8-4CBC-895E-7B1B9475A527@yesql.se
Diffstat (limited to 'contrib/pgcrypto/imath.c')
-rw-r--r--contrib/pgcrypto/imath.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/contrib/pgcrypto/imath.c b/contrib/pgcrypto/imath.c
index da4cdede76f..9deaa797c1a 100644
--- a/contrib/pgcrypto/imath.c
+++ b/contrib/pgcrypto/imath.c
@@ -478,7 +478,7 @@ mp_int_init(mp_int z)
mp_int
mp_int_alloc(void)
{
- mp_int out = px_alloc(sizeof(mpz_t));
+ mp_int out = palloc(sizeof(mpz_t));
if (out != NULL)
mp_int_init(out);
@@ -604,7 +604,7 @@ mp_int_free(mp_int z)
assert(z != NULL);
mp_int_clear(z);
- px_free(z); /* note: NOT s_free() */
+ pfree(z); /* note: NOT s_free() */
}
mp_result
@@ -2212,7 +2212,7 @@ static const mp_digit fill = (mp_digit) 0xdeadbeefabad1dea;
static mp_digit *
s_alloc(mp_size num)
{
- mp_digit *out = px_alloc(num * sizeof(mp_digit));
+ mp_digit *out = palloc(num * sizeof(mp_digit));
assert(out != NULL);
@@ -2235,7 +2235,7 @@ s_realloc(mp_digit *old, mp_size osize, mp_size nsize)
new[ix] = fill;
memcpy(new, old, osize * sizeof(mp_digit));
#else
- mp_digit *new = px_realloc(old, nsize * sizeof(mp_digit));
+ mp_digit *new = repalloc(old, nsize * sizeof(mp_digit));
assert(new != NULL);
#endif
@@ -2246,7 +2246,7 @@ s_realloc(mp_digit *old, mp_size osize, mp_size nsize)
static void
s_free(void *ptr)
{
- px_free(ptr);
+ pfree(ptr);
}
static bool