Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9d299a4

Browse files
committed
Minor mop-up for List improvements.
Fix a few places that were using written-out versions of the pg_list.h macros that commit cc99baa just improved, making them also use those macros so as to gain whatever performance improvement is to be had. Discussion: https://postgr.es/m/CAApHDvpo1zj9KhEpU2cCRZfSM3Q6XGdhzuAS2v79PH7WJBkYVA@mail.gmail.com
1 parent 0baf82f commit 9d299a4

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/backend/catalog/objectaddress.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1506,7 +1506,7 @@ get_object_address_attribute(ObjectType objtype, List *object,
15061506
ereport(ERROR,
15071507
(errcode(ERRCODE_SYNTAX_ERROR),
15081508
errmsg("column name must be qualified")));
1509-
attname = strVal(lfirst(list_tail(object)));
1509+
attname = strVal(llast(object));
15101510
relname = list_truncate(list_copy(object), list_length(object) - 1);
15111511
/* XXX no missing_ok support here */
15121512
relation = relation_openrv(makeRangeVarFromNameList(relname), lockmode);

src/backend/commands/sequence.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1668,7 +1668,7 @@ process_owned_by(Relation seqrel, List *owned_by, bool for_identity)
16681668

16691669
/* Separate relname and attr name */
16701670
relname = list_truncate(list_copy(owned_by), nnames - 1);
1671-
attrname = strVal(lfirst(list_tail(owned_by)));
1671+
attrname = strVal(llast(owned_by));
16721672

16731673
/* Open and lock rel to ensure it won't go away meanwhile */
16741674
rel = makeRangeVarFromNameList(relname);

src/backend/nodes/list.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ lappend(List *list, void *datum)
327327
else
328328
new_tail_cell(list);
329329

330-
lfirst(list_tail(list)) = datum;
330+
llast(list) = datum;
331331
check_list_invariants(list);
332332
return list;
333333
}
@@ -345,7 +345,7 @@ lappend_int(List *list, int datum)
345345
else
346346
new_tail_cell(list);
347347

348-
lfirst_int(list_tail(list)) = datum;
348+
llast_int(list) = datum;
349349
check_list_invariants(list);
350350
return list;
351351
}
@@ -363,7 +363,7 @@ lappend_oid(List *list, Oid datum)
363363
else
364364
new_tail_cell(list);
365365

366-
lfirst_oid(list_tail(list)) = datum;
366+
llast_oid(list) = datum;
367367
check_list_invariants(list);
368368
return list;
369369
}
@@ -459,7 +459,7 @@ lcons(void *datum, List *list)
459459
else
460460
new_head_cell(list);
461461

462-
lfirst(list_head(list)) = datum;
462+
linitial(list) = datum;
463463
check_list_invariants(list);
464464
return list;
465465
}
@@ -477,7 +477,7 @@ lcons_int(int datum, List *list)
477477
else
478478
new_head_cell(list);
479479

480-
lfirst_int(list_head(list)) = datum;
480+
linitial_int(list) = datum;
481481
check_list_invariants(list);
482482
return list;
483483
}
@@ -495,7 +495,7 @@ lcons_oid(Oid datum, List *list)
495495
else
496496
new_head_cell(list);
497497

498-
lfirst_oid(list_head(list)) = datum;
498+
linitial_oid(list) = datum;
499499
check_list_invariants(list);
500500
return list;
501501
}

0 commit comments

Comments
 (0)