aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/acl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/adt/acl.c')
-rw-r--r--src/backend/utils/adt/acl.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c
index d7e6100ccbf..79bc750d775 100644
--- a/src/backend/utils/adt/acl.c
+++ b/src/backend/utils/adt/acl.c
@@ -28,6 +28,7 @@
#include "commands/tablespace.h"
#include "foreign/foreign.h"
#include "funcapi.h"
+#include "lib/qunique.h"
#include "miscadmin.h"
#include "utils/acl.h"
#include "utils/array.h"
@@ -1475,8 +1476,7 @@ aclmembers(const Acl *acl, Oid **roleids)
Oid *list;
const AclItem *acldat;
int i,
- j,
- k;
+ j;
if (acl == NULL || ACL_NUM(acl) == 0)
{
@@ -1508,21 +1508,14 @@ aclmembers(const Acl *acl, Oid **roleids)
/* Sort the array */
qsort(list, j, sizeof(Oid), oid_cmp);
- /* Remove duplicates from the array */
- k = 0;
- for (i = 1; i < j; i++)
- {
- if (list[k] != list[i])
- list[++k] = list[i];
- }
-
/*
* We could repalloc the array down to minimum size, but it's hardly worth
* it since it's only transient memory.
*/
*roleids = list;
- return k + 1;
+ /* Remove duplicates from the array */
+ return qunique(list, j, sizeof(Oid), oid_cmp);
}