Skip to content

Commit 0858ed2

Browse files
committed
A couple other cosmetic cleanups in new List stuff.
1 parent 437063b commit 0858ed2

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

src/backend/utils/adt/ruleutils.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* back to source text
44
*
55
* IDENTIFICATION
6-
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.167 2004/05/26 04:41:38 neilc Exp $
6+
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.168 2004/05/26 19:30:12 tgl Exp $
77
*
88
* This software is copyrighted by Jan Wieck - Hamburg.
99
*
@@ -2274,17 +2274,14 @@ static void
22742274
get_names_for_var(Var *var, deparse_context *context,
22752275
char **schemaname, char **refname, char **attname)
22762276
{
2277-
ListCell *nslist_item = list_head(context->namespaces);
2278-
int sup = var->varlevelsup;
22792277
deparse_namespace *dpns;
22802278
RangeTblEntry *rte;
22812279

22822280
/* Find appropriate nesting depth */
2283-
while (sup-- > 0 && nslist_item != NULL)
2284-
nslist_item = lnext(nslist_item);
2285-
if (nslist_item == NULL)
2281+
if (var->varlevelsup >= list_length(context->namespaces))
22862282
elog(ERROR, "bogus varlevelsup: %d", var->varlevelsup);
2287-
dpns = (deparse_namespace *) lfirst(nslist_item);
2283+
dpns = (deparse_namespace *) list_nth(context->namespaces,
2284+
var->varlevelsup);
22882285

22892286
/* Find the relevant RTE */
22902287
if (var->varno >= 1 && var->varno <= length(dpns->rtable))

src/include/nodes/pg_list.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/nodes/pg_list.h,v 1.44 2004/05/26 04:41:45 neilc Exp $
10+
* $PostgreSQL: pgsql/src/include/nodes/pg_list.h,v 1.45 2004/05/26 19:30:17 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -49,8 +49,6 @@
4949
* always be so; try to be careful to maintain the distinction.)
5050
*/
5151

52-
#define LIST_CELL_TYPE ListCell
53-
5452
typedef struct ListCell ListCell;
5553
typedef struct List List;
5654

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy