Commit 303e089d authored by Tom Lane's avatar Tom Lane

Clean up possibly-uninitialized-variable warnings reported by gcc 4.x.

parent 5d9c6b18
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.124 2005/08/11 13:22:33 momjian Exp $
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.125 2005/09/24 22:54:35 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -49,8 +49,7 @@ static void _bt_insertonpg(Relation rel, Buffer buf,
bool split_only_page);
static Buffer _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
OffsetNumber newitemoff, Size newitemsz,
BTItem newitem, bool newitemonleft,
OffsetNumber *itup_off, BlockNumber *itup_blkno);
BTItem newitem, bool newitemonleft);
static OffsetNumber _bt_findsplitloc(Relation rel, Page page,
OffsetNumber newitemoff,
Size newitemsz,
......@@ -365,8 +364,6 @@ _bt_insertonpg(Relation rel,
{
Page page;
BTPageOpaque lpageop;
OffsetNumber itup_off;
BlockNumber itup_blkno;
OffsetNumber newitemoff;
OffsetNumber firstright = InvalidOffsetNumber;
Size itemsz;
......@@ -490,8 +487,7 @@ _bt_insertonpg(Relation rel,
/* split the buffer into left and right halves */
rbuf = _bt_split(rel, buf, firstright,
newitemoff, itemsz, btitem, newitemonleft,
&itup_off, &itup_blkno);
newitemoff, itemsz, btitem, newitemonleft);
/*----------
* By here,
......@@ -516,6 +512,8 @@ _bt_insertonpg(Relation rel,
Buffer metabuf = InvalidBuffer;
Page metapg = NULL;
BTMetaPageData *metad = NULL;
OffsetNumber itup_off;
BlockNumber itup_blkno;
itup_off = newitemoff;
itup_blkno = BufferGetBlockNumber(buf);
......@@ -640,14 +638,12 @@ _bt_insertonpg(Relation rel,
* must be inserted along with the data from the old page.
*
* Returns the new right sibling of buf, pinned and write-locked.
* The pin and lock on buf are maintained. *itup_off and *itup_blkno
* are set to the exact location where newitem was inserted.
* The pin and lock on buf are maintained.
*/
static Buffer
_bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
OffsetNumber newitemoff, Size newitemsz, BTItem newitem,
bool newitemonleft,
OffsetNumber *itup_off, BlockNumber *itup_blkno)
bool newitemonleft)
{
Buffer rbuf;
Page origpage;
......@@ -659,6 +655,8 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
Buffer sbuf = InvalidBuffer;
Page spage = NULL;
BTPageOpaque sopaque = NULL;
OffsetNumber itup_off = 0;
BlockNumber itup_blkno = 0;
Size itemsz;
ItemId itemid;
BTItem item;
......@@ -752,16 +750,16 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
{
_bt_pgaddtup(rel, leftpage, newitemsz, newitem, leftoff,
"left sibling");
*itup_off = leftoff;
*itup_blkno = BufferGetBlockNumber(buf);
itup_off = leftoff;
itup_blkno = BufferGetBlockNumber(buf);
leftoff = OffsetNumberNext(leftoff);
}
else
{
_bt_pgaddtup(rel, rightpage, newitemsz, newitem, rightoff,
"right sibling");
*itup_off = rightoff;
*itup_blkno = BufferGetBlockNumber(rbuf);
itup_off = rightoff;
itup_blkno = BufferGetBlockNumber(rbuf);
rightoff = OffsetNumberNext(rightoff);
}
}
......@@ -788,16 +786,16 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
{
_bt_pgaddtup(rel, leftpage, newitemsz, newitem, leftoff,
"left sibling");
*itup_off = leftoff;
*itup_blkno = BufferGetBlockNumber(buf);
itup_off = leftoff;
itup_blkno = BufferGetBlockNumber(buf);
leftoff = OffsetNumberNext(leftoff);
}
else
{
_bt_pgaddtup(rel, rightpage, newitemsz, newitem, rightoff,
"right sibling");
*itup_off = rightoff;
*itup_blkno = BufferGetBlockNumber(rbuf);
itup_off = rightoff;
itup_blkno = BufferGetBlockNumber(rbuf);
rightoff = OffsetNumberNext(rightoff);
}
}
......@@ -839,7 +837,7 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
XLogRecData rdata[4];
xlrec.target.node = rel->rd_node;
ItemPointerSet(&(xlrec.target.tid), *itup_blkno, *itup_off);
ItemPointerSet(&(xlrec.target.tid), itup_blkno, itup_off);
if (newitemonleft)
xlrec.otherblk = BufferGetBlockNumber(rbuf);
else
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.132 2005/07/07 20:39:57 tgl Exp $
* $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.133 2005/09/24 22:54:35 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -789,21 +789,27 @@ match_prosrc_to_literal(const char *prosrc, const char *literal,
else if (*literal == '\'')
{
if (literal[1] != '\'')
return false;
goto fail;
literal++;
if (cursorpos > 0)
newcp++;
}
chlen = pg_mblen(prosrc);
if (strncmp(prosrc, literal, chlen) != 0)
return false;
goto fail;
prosrc += chlen;
literal += chlen;
}
*newcursorpos = newcp;
if (*literal == '\'' && literal[1] != '\'')
{
/* success */
*newcursorpos = newcp;
return true;
}
fail:
/* Must set *newcursorpos to suppress compiler warning */
*newcursorpos = newcp;
return false;
}
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.250 2005/09/24 17:53:12 tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.251 2005/09/24 22:54:36 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -542,7 +542,10 @@ CopyGetInt32(CopyState cstate, int32 *val)
uint32 buf;
if (CopyGetData(cstate, &buf, sizeof(buf), sizeof(buf)) != sizeof(buf))
{
*val = 0; /* suppress compiler warning */
return false;
}
*val = (int32) ntohl(buf);
return true;
}
......@@ -568,7 +571,10 @@ CopyGetInt16(CopyState cstate, int16 *val)
uint16 buf;
if (CopyGetData(cstate, &buf, sizeof(buf), sizeof(buf)) != sizeof(buf))
{
*val = 0; /* suppress compiler warning */
return false;
}
*val = (int16) ntohs(buf);
return true;
}
......
......@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.67 2005/09/08 20:07:41 tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.68 2005/09/24 22:54:36 tgl Exp $
*
* DESCRIPTION
* These routines take the parse tree and pick out the
......@@ -158,6 +158,8 @@ examine_parameter_list(List *parameters, Oid languageOid,
ListCell *x;
int i;
*requiredResultType = InvalidOid; /* default result */
inTypes = (Oid *) palloc(parameterCount * sizeof(Oid));
allTypes = (Datum *) palloc(parameterCount * sizeof(Datum));
paramModes = (Datum *) palloc(parameterCount * sizeof(Datum));
......@@ -243,7 +245,6 @@ examine_parameter_list(List *parameters, Oid languageOid,
{
*allParameterTypes = NULL;
*parameterModes = NULL;
*requiredResultType = InvalidOid;
}
if (have_names)
......@@ -383,16 +384,22 @@ compute_attributes_sql_style(List *options,
if (as_item)
*as = (List *) as_item->arg;
else
{
ereport(ERROR,
(errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
errmsg("no function body specified")));
*as = NIL; /* keep compiler quiet */
}
if (language_item)
*language = strVal(language_item->arg);
else
{
ereport(ERROR,
(errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
errmsg("no language specified")));
*language = NULL; /* keep compiler quiet */
}
/* process optional items */
if (volatility_item)
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.170 2005/08/26 03:07:16 tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.171 2005/09/24 22:54:36 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -4109,6 +4109,8 @@ transformFkeyGetPrimaryKey(Relation pkrel, Oid *indexOid,
* look up each one in the pg_index syscache until we find one marked
* primary key (hopefully there isn't more than one such).
*/
*indexOid = InvalidOid;
indexoidlist = RelationGetIndexList(pkrel);
foreach(indexoidscan, indexoidlist)
......@@ -4127,7 +4129,6 @@ transformFkeyGetPrimaryKey(Relation pkrel, Oid *indexOid,
break;
}
ReleaseSysCache(indexTuple);
indexStruct = NULL;
}
list_free(indexoidlist);
......@@ -4135,7 +4136,7 @@ transformFkeyGetPrimaryKey(Relation pkrel, Oid *indexOid,
/*
* Check that we found it
*/
if (indexStruct == NULL)
if (!OidIsValid(*indexOid))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("there is no primary key for referenced table \"%s\"",
......
......@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.189 2005/09/22 23:25:07 tgl Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.190 2005/09/24 22:54:36 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -65,10 +65,9 @@ static bool matches_any_index(RestrictInfo *rinfo, RelOptInfo *rel,
Relids outer_relids);
static List *find_clauses_for_join(PlannerInfo *root, RelOptInfo *rel,
Relids outer_relids, bool isouterjoin);
static bool match_variant_ordering(PlannerInfo *root,
IndexOptInfo *index,
List *restrictclauses,
ScanDirection *indexscandir);
static ScanDirection match_variant_ordering(PlannerInfo *root,
IndexOptInfo *index,
List *restrictclauses);
static List *identify_ignorable_ordering_cols(PlannerInfo *root,
IndexOptInfo *index,
List *restrictclauses);
......@@ -362,15 +361,15 @@ find_usable_indexes(PlannerInfo *root, RelOptInfo *rel,
root->query_pathkeys != NIL &&
pathkeys_useful_for_ordering(root, useful_pathkeys) == 0)
{
ScanDirection indexscandir;
ScanDirection scandir;
if (match_variant_ordering(root, index, restrictclauses,
&indexscandir))
scandir = match_variant_ordering(root, index, restrictclauses);
if (!ScanDirectionIsNoMovement(scandir))
{
ipath = create_index_path(root, index,
restrictclauses,
root->query_pathkeys,
indexscandir,
scandir,
false);
result = lappend(result, ipath);
}
......@@ -1304,15 +1303,14 @@ find_clauses_for_join(PlannerInfo *root, RelOptInfo *rel,
* 'restrictclauses' is the list of sublists of restriction clauses
* matching the columns of the index (NIL if none)
*
* Returns TRUE if able to match the requested query pathkeys, FALSE if not.
* In the TRUE case, sets '*indexscandir' to either ForwardScanDirection or
* BackwardScanDirection to indicate the proper scan direction.
* If able to match the requested query pathkeys, returns either
* ForwardScanDirection or BackwardScanDirection to indicate the proper index
* scan direction. If no match, returns NoMovementScanDirection.
*/
static bool
static ScanDirection
match_variant_ordering(PlannerInfo *root,
IndexOptInfo *index,
List *restrictclauses,
ScanDirection *indexscandir)
List *restrictclauses)
{
List *ignorables;
......@@ -1328,7 +1326,7 @@ match_variant_ordering(PlannerInfo *root,
* won't cope.
*/
if (index->relam != BTREE_AM_OID)
return false;
return NoMovementScanDirection;
/*
* Figure out which index columns can be optionally ignored because
* they have an equality constraint. This is the same set for either
......@@ -1344,17 +1342,13 @@ match_variant_ordering(PlannerInfo *root,
if (ignorables &&
match_index_to_query_keys(root, index, ForwardScanDirection,
ignorables))
{
*indexscandir = ForwardScanDirection;
return true;
}
return ForwardScanDirection;
if (match_index_to_query_keys(root, index, BackwardScanDirection,
ignorables))
{
*indexscandir = BackwardScanDirection;
return true;
}
return false;
return BackwardScanDirection;
return NoMovementScanDirection;
}
/*
......
......@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.197 2005/08/18 17:51:11 tgl Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.198 2005/09/24 22:54:37 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -1634,7 +1634,8 @@ fix_indexqual_operand(Node *node, IndexOptInfo *index, Oid *opclass)
/* Ooops... */
elog(ERROR, "node is not an index attribute");
return NULL; /* keep compiler quiet */
*opclass = InvalidOid; /* keep compiler quiet */
return NULL;
}
/*
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/plan/planner.c,v 1.192 2005/08/27 22:13:43 tgl Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/plan/planner.c,v 1.193 2005/09/24 22:54:37 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -649,8 +649,8 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
{
Query *parse = root->parse;
List *tlist = parse->targetList;
int offset_est;
int count_est;
int offset_est = 0;
int count_est = 0;
Plan *result_plan;
List *current_pathkeys;
List *sort_pathkeys;
......
......@@ -28,7 +28,7 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $PostgreSQL: pgsql/src/backend/regex/rege_dfa.c,v 1.4 2003/11/29 19:51:55 pgsql Exp $
* $PostgreSQL: pgsql/src/backend/regex/rege_dfa.c,v 1.5 2005/09/24 22:54:38 tgl Exp $
*
*/
......@@ -578,7 +578,6 @@ getvacant(struct vars * v, /* used only for debug flags */
struct sset *ss;
struct sset *p;
struct arcp ap;
struct arcp lastap;
color co;
ss = pickss(v, d, cp, start);
......@@ -608,6 +607,8 @@ getvacant(struct vars * v, /* used only for debug flags */
p->ins = ss->inchain[i];
else
{
struct arcp lastap = {NULL, 0};
assert(p->ins.ss != NULL);
for (ap = p->ins; ap.ss != NULL &&
!(ap.ss == ss && ap.co == i);
......
......@@ -27,7 +27,7 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $PostgreSQL: pgsql/src/backend/regex/regexec.c,v 1.25 2005/07/10 04:54:30 momjian Exp $
* $PostgreSQL: pgsql/src/backend/regex/regexec.c,v 1.26 2005/09/24 22:54:38 tgl Exp $
*
*/
......@@ -464,6 +464,7 @@ cfindloop(struct vars * v,
if (er != REG_NOMATCH)
{
ERR(er);
*coldp = cold;
return er;
}
if ((shorter) ? end == estop : end == begin)
......
......@@ -14,7 +14,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $PostgreSQL: pgsql/src/backend/utils/adt/inet_net_ntop.c,v 1.19 2005/02/01 00:59:09 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/inet_net_ntop.c,v 1.20 2005/09/24 22:54:38 tgl Exp $
*/
#if defined(LIBC_SCCS) && !defined(lint)
......@@ -443,6 +443,8 @@ inet_net_ntop_ipv6(const u_char *src, int bits, char *dst, size_t size)
words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3));
best.base = -1;
cur.base = -1;
best.len = 0;
cur.len = 0;
for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++)
{
if (words[i] == 0)
......
......@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/nabstime.c,v 1.142 2005/07/23 14:25:33 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/nabstime.c,v 1.143 2005/09/24 22:54:38 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -79,9 +79,9 @@
static AbsoluteTime tm2abstime(struct pg_tm *tm, int tz);
static void reltime2tm(RelativeTime time, struct pg_tm *tm);
static int istinterval(char *i_string,
AbsoluteTime *i_start,
AbsoluteTime *i_end);
static void parsetinterval(char *i_string,
AbsoluteTime *i_start,
AbsoluteTime *i_end);
/*
......@@ -727,24 +727,19 @@ tintervalin(PG_FUNCTION_ARGS)
t1,
t2;
tinterval = (TimeInterval) palloc(sizeof(TimeIntervalData));
parsetinterval(tintervalstr, &t1, &t2);
if (istinterval(tintervalstr, &t1, &t2) == 0)
ereport(ERROR,
(errcode(ERRCODE_INVALID_DATETIME_FORMAT),
errmsg("invalid input syntax for type tinterval: \"%s\"",
tintervalstr)));
tinterval = (TimeInterval) palloc(sizeof(TimeIntervalData));
if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME)
tinterval ->status = T_INTERVAL_INVAL; /* undefined */
tinterval->status = T_INTERVAL_INVAL; /* undefined */
else
tinterval ->status = T_INTERVAL_VALID;
tinterval->status = T_INTERVAL_VALID;
i_start = ABSTIMEMIN(t1, t2);
i_end = ABSTIMEMAX(t1, t2);
tinterval ->data[0] = i_start;
tinterval ->data[1] = i_end;
tinterval->data[0] = i_start;
tinterval->data[1] = i_end;
PG_RETURN_TIMEINTERVAL(tinterval);
}
......@@ -1444,11 +1439,9 @@ tintervalend(PG_FUNCTION_ARGS)
*****************************************************************************/
/*
* istinterval - returns 1, iff i_string is a valid tinterval descr.
* 0, iff i_string is NOT a valid tinterval desc.
* 2, iff any time is INVALID_ABSTIME
* parsetinterval -- parse a tinterval string
*
* output parameter:
* output parameters:
* i_start, i_end: tinterval margins
*
* Time interval:
......@@ -1460,10 +1453,10 @@ tintervalend(PG_FUNCTION_ARGS)
*
* e.g. [ ' Jan 18 1902' 'Jan 1 00:00:00 1970']
*/
static int
istinterval(char *i_string,
AbsoluteTime *i_start,
AbsoluteTime *i_end)
static void
parsetinterval(char *i_string,
AbsoluteTime *i_start,
AbsoluteTime *i_end)
{
char *p,
*p1;
......@@ -1476,10 +1469,12 @@ istinterval(char *i_string,
if (IsSpace(c))
p++;
else if (c != '[')
return 0; /* syntax error */
goto bogus; /* syntax error */
else
break;
}
if (c == '\0')
goto bogus; /* syntax error */
p++;
/* skip leading blanks up to '"' */
while ((c = *p) != '\0')
......@@ -1487,30 +1482,32 @@ istinterval(char *i_string,
if (IsSpace(c))
p++;
else if (c != '"')
return 0; /* syntax error */
goto bogus; /* syntax error */
else
break;
}
if (c == '\0')
goto bogus; /* syntax error */
p++;
if (strncmp(INVALID_INTERVAL_STR, p, strlen(INVALID_INTERVAL_STR)) == 0)
return 0; /* undefined range, handled like a syntax
goto bogus; /* undefined range, handled like a syntax
* err. */
/* search for the end of the first date and change it to a NULL */
/* search for the end of the first date and change it to a \0 */
p1 = p;
while ((c = *p1) != '\0')
{
if (c == '"')
{
*p1 = '\0';
break;
}
p1++;
}
if (c == '\0')
goto bogus; /* syntax error */
*p1 = '\0';
/* get the first date */
*i_start = DatumGetAbsoluteTime(DirectFunctionCall1(abstimein,
CStringGetDatum(p)));
/* rechange NULL at the end of the first date to a '"' */
*p1 = '"';
/* undo change to \0 */
*p1 = c;
p = ++p1;
/* skip blanks up to '"', beginning of second date */
while ((c = *p) != '\0')
......@@ -1518,27 +1515,29 @@ istinterval(char *i_string,
if (IsSpace(c))
p++;
else if (c != '"')
return 0; /* syntax error */
goto bogus; /* syntax error */
else
break;
}
if (c == '\0')
goto bogus; /* syntax error */
p++;
/* search for the end of the second date and change it to a NULL */
/* search for the end of the second date and change it to a \0 */
p1 = p;
while ((c = *p1) != '\0')
{
if (c == '"')
{
*p1 = '\0';
break;
}
p1++;
}
if (c == '\0')
goto bogus; /* syntax error */
*p1 = '\0';
/* get the second date */
*i_end = DatumGetAbsoluteTime(DirectFunctionCall1(abstimein,
CStringGetDatum(p)));
/* rechange NULL at the end of the first date to a '"' */
*p1 = '"';
/* undo change to \0 */
*p1 = c;
p = ++p1;
/* skip blanks up to ']' */
while ((c = *p) != '\0')
......@@ -1546,16 +1545,26 @@ istinterval(char *i_string,
if (IsSpace(c))
p++;
else if (c != ']')
return 0; /* syntax error */
goto bogus; /* syntax error */
else
break;
}
if (c == '\0')
goto bogus; /* syntax error */
p++;
c = *p;
if (c != '\0')
return 0; /* syntax error */
goto bogus; /* syntax error */
/* it seems to be a valid tinterval */
return 1;
return;
bogus:
ereport(ERROR,
(errcode(ERRCODE_INVALID_DATETIME_FORMAT),
errmsg("invalid input syntax for type tinterval: \"%s\"",
i_string)));
*i_start = *i_end = INVALID_ABSTIME; /* keep compiler quiet */
}
......
......@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.188 2005/09/24 17:53:16 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.189 2005/09/24 22:54:38 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -2403,6 +2403,7 @@ convert_to_scalar(Datum value, Oid valuetypid, double *scaledvalue,
return true;
}
/* Don't know how to convert */
*scaledvalue = *scaledlobound = *scaledhibound = 0;
return false;
}
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/cache/catcache.c,v 1.123 2005/08/13 22:18:07 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/cache/catcache.c,v 1.124 2005/09/24 22:54:39 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -161,6 +161,8 @@ GetCCHashEqFuncs(Oid keytype, PGFunction *hashfunc, RegProcedure *eqfunc)
break;
default:
elog(FATAL, "type %u not supported as catcache key", keytype);
*hashfunc = NULL; /* keep compiler quiet */
*eqfunc = InvalidOid;
break;
}
}
......
......@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.288 2005/09/12 02:26:32 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.289 2005/09/24 22:54:39 tgl Exp $
*
*--------------------------------------------------------------------
*/
......@@ -3401,7 +3401,11 @@ parse_bool(const char *value, bool *result)
}
else
{
if (result)
*result = false; /* suppress compiler warning */
return false;
}
return true;
}
......@@ -3427,7 +3431,11 @@ parse_int(const char *value, int *result)
|| val != (long) ((int32) val)
#endif
)
{
if (result)
*result = 0; /* suppress compiler warning */
return false;
}
if (result)
*result = (int) val;
return true;
......@@ -3449,7 +3457,11 @@ parse_real(const char *value, double *result)
errno = 0;
val = strtod(value, &endptr);
if (endptr == value || *endptr != '\0' || errno == ERANGE)
{
if (result)
*result = 0; /* suppress compiler warning */
return false;
}
if (result)
*result = val;
return true;
......
......@@ -334,6 +334,8 @@ PGTYPESdate_defmt_asc(date *d, char *fmt, char *str)
char *str_copy;
struct tm tm;
tm.tm_year = tm.tm_mon = tm.tm_mday = 0; /* keep compiler quiet */
if (!d || !str || !fmt)
{
errno = PGTYPES_DATE_ERR_EARGS;
......
......@@ -3,7 +3,7 @@
* procedural language
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.92 2005/07/06 16:42:10 tgl Exp $
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.93 2005/09/24 22:54:44 tgl Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
......@@ -1395,24 +1395,22 @@ plpgsql_parse_tripwordtype(char *word)
for (i = 0; i < qualified_att_len; i++)
{
if (word[i] == '.' && ++numdots == 2)
{
cp[0] = (char *) palloc((i + 1) * sizeof(char));
memset(cp[0], 0, (i + 1) * sizeof(char));
memcpy(cp[0], word, i * sizeof(char));
/*
* qualified_att_len - one based position + 1 (null
* terminator)
*/
cp[1] = (char *) palloc((qualified_att_len - i) * sizeof(char));
memset(cp[1], 0, (qualified_att_len - i) * sizeof(char));
memcpy(cp[1], &word[i + 1], (qualified_att_len - i - 1) * sizeof(char));
break;
}
}
relvar = makeRangeVarFromNameList(stringToQualifiedNameList(cp[0], "plpgsql_parse_tripwordtype"));
cp[0] = (char *) palloc((i + 1) * sizeof(char));
memcpy(cp[0], word, i * sizeof(char));
cp[0][i] = '\0';
/*
* qualified_att_len - one based position + 1 (null terminator)
*/
cp[1] = (char *) palloc((qualified_att_len - i) * sizeof(char));
memcpy(cp[1], &word[i + 1], (qualified_att_len - i - 1) * sizeof(char));
cp[1][qualified_att_len - i - 1] = '\0';
relvar = makeRangeVarFromNameList(stringToQualifiedNameList(cp[0],
"plpgsql_parse_tripwordtype"));
classOid = RangeVarGetRelid(relvar, true);
if (!OidIsValid(classOid))
goto done;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment