]> granicus.if.org Git - postgresql/commitdiff
A couple other cosmetic cleanups in new List stuff.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 26 May 2004 19:30:17 +0000 (19:30 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 26 May 2004 19:30:17 +0000 (19:30 +0000)
src/backend/utils/adt/ruleutils.c
src/include/nodes/pg_list.h

index 213dc61202ba768731b7cee7de45087f2de1d0bb..0356b183fca62b1fa6deadc8765ef7b6a1489069 100644 (file)
@@ -3,7 +3,7 @@
  *                             back to source text
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.167 2004/05/26 04:41:38 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.168 2004/05/26 19:30:12 tgl Exp $
  *
  *       This software is copyrighted by Jan Wieck - Hamburg.
  *
@@ -2274,17 +2274,14 @@ static void
 get_names_for_var(Var *var, deparse_context *context,
                                  char **schemaname, char **refname, char **attname)
 {
-       ListCell   *nslist_item = list_head(context->namespaces);
-       int                     sup = var->varlevelsup;
        deparse_namespace *dpns;
        RangeTblEntry *rte;
 
        /* Find appropriate nesting depth */
-       while (sup-- > 0 && nslist_item != NULL)
-               nslist_item = lnext(nslist_item);
-       if (nslist_item == NULL)
+       if (var->varlevelsup >= list_length(context->namespaces))
                elog(ERROR, "bogus varlevelsup: %d", var->varlevelsup);
-       dpns = (deparse_namespace *) lfirst(nslist_item);
+       dpns = (deparse_namespace *) list_nth(context->namespaces,
+                                                                                 var->varlevelsup);
 
        /* Find the relevant RTE */
        if (var->varno >= 1 && var->varno <= length(dpns->rtable))
index 31c90de88c92e1abeca5af0dc1c6d02912b47ce2..08a11ef552ee9fddb3bd4b11a90ffd723b30a1b2 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/nodes/pg_list.h,v 1.44 2004/05/26 04:41:45 neilc Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/pg_list.h,v 1.45 2004/05/26 19:30:17 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -49,8 +49,6 @@
  * always be so; try to be careful to maintain the distinction.)
  */
 
-#define LIST_CELL_TYPE ListCell
-
 typedef struct ListCell ListCell;
 typedef struct List List;