]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
nss: Remove effectively unused struct nss_database_default_cache
authorFlorian Weimer <fweimer@redhat.com>
Mon, 17 Nov 2025 17:43:50 +0000 (18:43 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Tue, 18 Nov 2025 08:51:02 +0000 (09:51 +0100)
We always start with a zero-initialized cache, so this is completely
ineffective.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
nss/nss_database.c

index a7ac32beb9f80f63ef7108fa41d8670362ebc079..bed353c59b35a5623ca22154b9495e4fdd8f9355 100644 (file)
@@ -105,19 +105,10 @@ static const char per_database_defaults[NSS_DATABASE_COUNT] =
    [nss_database_shadow_compat] = nss_database_default_nis,
   };
 
-struct nss_database_default_cache
-{
-  nss_action_list caches[NSS_DATABASE_DEFAULT_COUNT];
-};
-
 static bool
-nss_database_select_default (struct nss_database_default_cache *cache,
-                             enum nss_database db, nss_action_list *result)
+nss_database_select_default (enum nss_database db, nss_action_list *result)
 {
   enum nss_database_default def = per_database_defaults[db];
-  *result = cache->caches[def];
-  if (*result != NULL)
-    return true;
 
   /* Determine the default line string.  */
   const char *line;
@@ -337,8 +328,6 @@ nss_database_reload (struct nss_database_data *staging,
   /* Apply defaults.  */
   if (ok)
     {
-      struct nss_database_default_cache cache = { };
-
       /* These three default to other services if the user listed the
         other service.  */
 
@@ -365,8 +354,7 @@ nss_database_reload (struct nss_database_data *staging,
       for (int i = 0; i < NSS_DATABASE_COUNT; ++i)
         if (staging->services[i] == NULL)
           {
-            ok = nss_database_select_default (&cache, i,
-                                              &staging->services[i]);
+            ok = nss_database_select_default (i, &staging->services[i]);
             if (!ok)
               break;
           }