Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
a36a7a16
Commit
a36a7a16
authored
May 12, 1999
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bogus assumption that MAXALIGN is at least sizeof(pointer).
parent
5085132c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
9 deletions
+14
-9
src/interfaces/libpq/fe-exec.c
src/interfaces/libpq/fe-exec.c
+14
-9
No files found.
src/interfaces/libpq/fe-exec.c
View file @
a36a7a16
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.7
8 1999/04/04 20:10:12
tgl Exp $
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.7
9 1999/05/12 04:38:24
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -92,11 +92,10 @@ static int getNotice(PGconn *conn);
* PGRESULT_SEP_ALLOC_THRESHOLD: objects bigger than this are given separate
* blocks, instead of being crammed into a regular allocation block.
* Requirements for correct function are:
* PGRESULT_ALIGN_BOUNDARY >= sizeof(pointer)
* to ensure the initial pointer in a block is not overwritten.
* PGRESULT_ALIGN_BOUNDARY must be a multiple of the alignment requirements
* of all machine data types.
* PGRESULT_SEP_ALLOC_THRESHOLD + PGRESULT_ALIGN_BOUNDARY <=
* of all machine data types. (Currently this is set from configure
* tests, so it should be OK automatically.)
* PGRESULT_SEP_ALLOC_THRESHOLD + PGRESULT_BLOCK_OVERHEAD <=
* PGRESULT_DATA_BLOCKSIZE
* pqResultAlloc assumes an object smaller than the threshold will fit
* in a new block.
...
...
@@ -105,8 +104,14 @@ static int getNotice(PGconn *conn);
* ----------------
*/
#ifdef MAX
#undef MAX
#endif
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define PGRESULT_DATA_BLOCKSIZE 2048
#define PGRESULT_ALIGN_BOUNDARY MAXIMUM_ALIGNOF
/* from configure */
#define PGRESULT_BLOCK_OVERHEAD MAX(sizeof(PGresult_data), PGRESULT_ALIGN_BOUNDARY)
#define PGRESULT_SEP_ALLOC_THRESHOLD (PGRESULT_DATA_BLOCKSIZE / 2)
...
...
@@ -213,10 +218,10 @@ pqResultAlloc(PGresult *res, int nBytes, int isBinary)
*/
if
(
nBytes
>=
PGRESULT_SEP_ALLOC_THRESHOLD
)
{
block
=
(
PGresult_data
*
)
malloc
(
nBytes
+
PGRESULT_
ALIGN_BOUNDARY
);
block
=
(
PGresult_data
*
)
malloc
(
nBytes
+
PGRESULT_
BLOCK_OVERHEAD
);
if
(
!
block
)
return
NULL
;
space
=
block
->
space
+
PGRESULT_
ALIGN_BOUNDARY
;
space
=
block
->
space
+
PGRESULT_
BLOCK_OVERHEAD
;
if
(
res
->
curBlock
)
{
/* Tuck special block below the active block, so that we don't
...
...
@@ -244,8 +249,8 @@ pqResultAlloc(PGresult *res, int nBytes, int isBinary)
if
(
isBinary
)
{
/* object needs full alignment */
res
->
curOffset
=
PGRESULT_
ALIGN_BOUNDARY
;
res
->
spaceLeft
=
PGRESULT_DATA_BLOCKSIZE
-
PGRESULT_
ALIGN_BOUNDARY
;
res
->
curOffset
=
PGRESULT_
BLOCK_OVERHEAD
;
res
->
spaceLeft
=
PGRESULT_DATA_BLOCKSIZE
-
PGRESULT_
BLOCK_OVERHEAD
;
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment