1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +03:00

Make use of new list primitives list_append_unique and list_concat_unique

where applicable.
This commit is contained in:
Tom Lane
2005-07-28 22:27:02 +00:00
parent ef85f5fabc
commit 5d27bf20b4
8 changed files with 44 additions and 65 deletions

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/acl.c,v 1.122 2005/07/26 16:38:27 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/acl.c,v 1.123 2005/07/28 22:27:02 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -2843,8 +2843,7 @@ has_privs_of_role(Oid member, Oid role)
* graph, we must test for having already seen this role.
* It is legal for instance to have both A->B and A->C->B.
*/
if (!list_member_oid(roles_list, otherid))
roles_list = lappend_oid(roles_list, otherid);
roles_list = list_append_unique_oid(roles_list, otherid);
}
ReleaseSysCacheList(memlist);
}
@@ -2931,8 +2930,7 @@ is_member_of_role(Oid member, Oid role)
* graph, we must test for having already seen this role.
* It is legal for instance to have both A->B and A->C->B.
*/
if (!list_member_oid(roles_list, otherid))
roles_list = lappend_oid(roles_list, otherid);
roles_list = list_append_unique_oid(roles_list, otherid);
}
ReleaseSysCacheList(memlist);
}
@@ -3024,8 +3022,7 @@ is_admin_of_role(Oid member, Oid role)
break;
}
if (!list_member_oid(roles_list, otherid))
roles_list = lappend_oid(roles_list, otherid);
roles_list = list_append_unique_oid(roles_list, otherid);
}
ReleaseSysCacheList(memlist);
if (result)

View File

@@ -23,7 +23,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/backend/utils/init/flatfiles.c,v 1.12 2005/07/04 04:51:50 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/init/flatfiles.c,v 1.13 2005/07/28 22:27:02 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -571,12 +571,8 @@ write_auth_file(Relation rel_authid, Relation rel_authmem)
* Now add all the new roles to roles_list.
*/
for (i = first_found; i <= last_found; i++)
{
Oid rolid = authmem_info[i].roleid;
if (!list_member_oid(roles_list, rolid))
roles_list = lappend_oid(roles_list, rolid);
}
roles_list = list_append_unique_oid(roles_list,
authmem_info[i].roleid);
}
/*