mirror of
https://github.com/postgres/postgres.git
synced 2025-07-08 11:42:09 +03:00
Prevent tv_sec from becoming negative in connection timeout code.
This commit is contained in:
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: nodes.h,v 1.118 2002/08/31 22:10:47 tgl Exp $
|
||||
* $Id: nodes.h,v 1.119 2002/10/11 04:12:14 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -261,6 +261,24 @@ typedef struct Node
|
||||
|
||||
#define nodeTag(nodeptr) (((Node*)(nodeptr))->type)
|
||||
|
||||
/*
|
||||
* There is no way to dereference the palloc'ed pointer to assign the
|
||||
* tag, and return the pointer itself, so we need a holder variable.
|
||||
* Fortunately, this function isn't recursive so we just define
|
||||
* a global variable for this purpose.
|
||||
*/
|
||||
extern Node *newNodeMacroHolder;
|
||||
|
||||
#define newNode(size, tag) \
|
||||
( \
|
||||
AssertMacro((size) >= sizeof(Node)), /* need the tag, at least */ \
|
||||
\
|
||||
newNodeMacroHolder = (Node *) palloc0(size), \
|
||||
newNodeMacroHolder->type = (tag), \
|
||||
newNodeMacroHolder \
|
||||
)
|
||||
|
||||
|
||||
#define makeNode(_type_) ((_type_ *) newNode(sizeof(_type_),T_##_type_))
|
||||
#define NodeSetTag(nodeptr,t) (((Node*)(nodeptr))->type = (t))
|
||||
|
||||
@ -282,11 +300,6 @@ typedef struct Node
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* nodes/nodes.c
|
||||
*/
|
||||
extern Node *newNode(Size size, NodeTag tag);
|
||||
|
||||
/*
|
||||
* nodes/{outfuncs.c,print.c}
|
||||
*/
|
||||
|
Reference in New Issue
Block a user