/* * Prepend a new element to the list. A pointer to the modified list * is returned. Note that this function may or may not destructively * modify the list; callers should always use this function's return * value, rather than continuing to use the pointer passed as the * second argument. * * Caution: before Postgres 8.0, the original List was unmodified and * could be considered to retain its separate identity. This is no longer * the case. */ List * lcons(void *datum, List *list) { Assert(IsPointerList(list)); if (list == NIL) list = new_list(T_List); else new_head_cell(list); lfirst(list->head) = datum; return list; }
/* * Prepend an OID to the list. See lcons() */ List * lcons_oid(Oid datum, List *list) { Assert(IsOidList(list)); if (list == NIL) list = new_list(T_OidList); else new_head_cell(list); lfirst_oid(list->head) = datum; check_list_invariants(list); return list; }
/* * Prepend an integer to the list. See lcons() */ List * lcons_int(int datum, List *list) { Assert(IsIntegerList(list)); if (list == NIL) list = new_list(T_IntList); else new_head_cell(list); lfirst_int(list->head) = datum; check_list_invariants(list); return list; }