dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0001-providers-proxy-small-optimization.patch

836b22
From 66b979b8d59a422dfbc7660016a09be44bc979f6 Mon Sep 17 00:00:00 2001
836b22
From: Alexey Tikhonov <atikhono@redhat.com>
836b22
Date: Mon, 28 Jan 2019 17:50:17 +0100
836b22
Subject: [PATCH 1/9] providers/proxy: small optimization
836b22
MIME-Version: 1.0
836b22
Content-Type: text/plain; charset=UTF-8
836b22
Content-Transfer-Encoding: 8bit
836b22
836b22
Small optimization of for-loops in
836b22
proxy_id.c:remove_duplicate_group_members()
836b22
836b22
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
836b22
(cherry picked from commit feb08323cc80cd8a487f991c04e99c3c2d4c5daf)
836b22
836b22
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
836b22
---
836b22
 src/providers/proxy/proxy_id.c | 8 ++++----
836b22
 1 file changed, 4 insertions(+), 4 deletions(-)
836b22
836b22
diff --git a/src/providers/proxy/proxy_id.c b/src/providers/proxy/proxy_id.c
836b22
index e82e60336..478709f69 100644
836b22
--- a/src/providers/proxy/proxy_id.c
836b22
+++ b/src/providers/proxy/proxy_id.c
836b22
@@ -602,9 +602,9 @@ static errno_t remove_duplicate_group_members(TALLOC_CTX *mem_ctx,
836b22
         goto done;
836b22
     }
836b22
 
836b22
-    for (i=0; orig_grp->gr_mem[i] != NULL; i++) {
836b22
-        orig_member_count++;
836b22
-    }
836b22
+    for (i=0; orig_grp->gr_mem[i] != NULL; ++i) /* no-op: just counting */;
836b22
+
836b22
+    orig_member_count = i;
836b22
 
836b22
     if (orig_member_count == 0) {
836b22
         ret = ENOENT;
836b22
@@ -618,7 +618,7 @@ static errno_t remove_duplicate_group_members(TALLOC_CTX *mem_ctx,
836b22
         goto done;
836b22
     }
836b22
 
836b22
-    for (i=0; orig_grp->gr_mem[i] != NULL; i++) {
836b22
+    for (i=0; i < orig_member_count; ++i) {
836b22
         key.type = HASH_KEY_STRING;
836b22
         key.str = talloc_strdup(member_tbl, orig_grp->gr_mem[i]);
836b22
         if (key.str == NULL) {
836b22
-- 
836b22
2.21.1
836b22