From 88381ade63de931c84f53dc873c986d40b8c8b61 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 11 Aug 2003 20:46:47 +0000 Subject: Code cleanup inspired by recent resname bug report (doesn't fix the bug yet, though). Avoid using nth() to fetch tlist entries; provide a common routine get_tle_by_resno() to search a tlist for a particular resno. This replaces a couple uses of nth() and a dozen hand-coded search loops. Also, replace a few uses of nth(length-1, list) with llast(). --- src/backend/executor/execJunk.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/backend/executor') diff --git a/src/backend/executor/execJunk.c b/src/backend/executor/execJunk.c index e976729a803..654fc7811a8 100644 --- a/src/backend/executor/execJunk.c +++ b/src/backend/executor/execJunk.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.35 2003/08/04 02:39:58 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.36 2003/08/11 20:46:46 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -185,10 +185,7 @@ ExecGetJunkAttribute(JunkFilter *junkfilter, { List *targetList; List *t; - Resdom *resdom; AttrNumber resno; - char *resname; - bool resjunk; TupleDesc tupType; HeapTuple tuple; @@ -202,11 +199,10 @@ ExecGetJunkAttribute(JunkFilter *junkfilter, foreach(t, targetList) { TargetEntry *tle = lfirst(t); + Resdom *resdom = tle->resdom; - resdom = tle->resdom; - resname = resdom->resname; - resjunk = resdom->resjunk; - if (resjunk && (strcmp(resname, attrName) == 0)) + if (resdom->resjunk && resdom->resname && + (strcmp(resdom->resname, attrName) == 0)) { /* We found it ! */ resno = resdom->resno; -- cgit v1.2.3