diff options
author | Bruce Momjian <bruce@momjian.us> | 2002-11-11 03:02:20 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2002-11-11 03:02:20 +0000 |
commit | 75fee4535d1a9741474b53bd46a3585ad3c66eb5 (patch) | |
tree | de4500a8b76fdb882f055ad7bd8889be9d51c790 /src/backend/utils/adt/varbit.c | |
parent | 5d283d89cb6142d721c095c28be19056ad620616 (diff) | |
download | postgresql-75fee4535d1a9741474b53bd46a3585ad3c66eb5.tar.gz postgresql-75fee4535d1a9741474b53bd46a3585ad3c66eb5.zip |
Back out use of palloc0 in place if palloc/MemSet. Seems constant len
to MemSet is a performance boost.
Diffstat (limited to 'src/backend/utils/adt/varbit.c')
-rw-r--r-- | src/backend/utils/adt/varbit.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/backend/utils/adt/varbit.c b/src/backend/utils/adt/varbit.c index 7d98491d779..69b8e226be4 100644 --- a/src/backend/utils/adt/varbit.c +++ b/src/backend/utils/adt/varbit.c @@ -9,7 +9,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/varbit.c,v 1.27 2002/11/10 07:25:14 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/varbit.c,v 1.28 2002/11/11 03:02:19 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -107,8 +107,9 @@ bit_in(PG_FUNCTION_ARGS) bitlen, atttypmod); len = VARBITTOTALLEN(atttypmod); + result = (VarBit *) palloc(len); /* set to 0 so that *r is always initialised and string is zero-padded */ - result = (VarBit *) palloc0(len); + MemSet(result, 0, len); VARATT_SIZEP(result) = len; VARBITLEN(result) = atttypmod; @@ -231,8 +232,9 @@ bit(PG_FUNCTION_ARGS) VARBITLEN(arg), len); rlen = VARBITTOTALLEN(len); + result = (VarBit *) palloc(rlen); /* set to 0 so that string is zero-padded */ - result = (VarBit *) palloc0(rlen); + MemSet(result, 0, rlen); VARATT_SIZEP(result) = rlen; VARBITLEN(result) = len; @@ -314,8 +316,9 @@ varbit_in(PG_FUNCTION_ARGS) atttypmod); len = VARBITTOTALLEN(bitlen); + result = (VarBit *) palloc(len); /* set to 0 so that *r is always initialised and string is zero-padded */ - result = (VarBit *) palloc0(len); + MemSet(result, 0, len); VARATT_SIZEP(result) = len; VARBITLEN(result) = Min(bitlen, atttypmod); |