loader: Remove redundant stores
authorCharles Giessen <charles@lunarg.com>
Mon, 17 May 2021 21:17:58 +0000 (15:17 -0600)
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>
Thu, 9 Sep 2021 18:15:49 +0000 (12:15 -0600)
`layer_node = layer_node->next;` is redundant in error paths that goto out.

Change-Id: I889b03c825f896f458a1ed3171b951d64d8827d7

loader/loader.c

index 7f8fda18821689be0a56c6dcfed74304e282f15e..6271c22d8453afc362551f5fcf1060c85c21c346 100644 (file)
@@ -1911,7 +1911,6 @@ static VkResult loader_read_layer_json(const struct loader_instance *inst, struc
     {                                                                      \
         var = cJSON_GetObjectItem(node, #var);                             \
         if (var == NULL) {                                                 \
-            layer_node = layer_node->next;                                 \
             loader_log(inst, VULKAN_LOADER_WARN_BIT, 0,                    \
                        "Didn't find required layer object %s in manifest " \
                        "JSON file, skipping this layer",                   \
@@ -1923,7 +1922,6 @@ static VkResult loader_read_layer_json(const struct loader_instance *inst, struc
     {                                                                          \
         item = cJSON_GetObjectItem(node, #var);                                \
         if (item == NULL) {                                                    \
-            layer_node = layer_node->next;                                     \
             loader_log(inst, VULKAN_LOADER_WARN_BIT, 0,                        \
                        "Didn't find required layer value %s in manifest JSON " \
                        "file, skipping this layer",                            \
@@ -1932,7 +1930,6 @@ static VkResult loader_read_layer_json(const struct loader_instance *inst, struc
         }                                                                      \
         temp = cJSON_Print(inst, item);                                        \
         if (temp == NULL) {                                                    \
-            layer_node = layer_node->next;                                     \
             loader_log(inst, VULKAN_LOADER_WARN_BIT, 0,                        \
                        "Problem accessing layer value %s in manifest JSON "    \
                        "file, skipping this layer",                            \
@@ -1953,8 +1950,7 @@ static VkResult loader_read_layer_json(const struct loader_instance *inst, struc
 
     // Add list entry
     if (!strcmp(type, "DEVICE")) {
-        loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_LAYER_BIT, 0, "Device layers are deprecated skipping this layer");
-        layer_node = layer_node->next;
+        loader_log(inst, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_LAYER_BIT, 0, "Device layers are deprecated. Skipping this layer");
         goto out;
     }
 
@@ -1962,7 +1958,6 @@ static VkResult loader_read_layer_json(const struct loader_instance *inst, struc
     // layers that must work with older loaders
     if (!strcmp(type, "INSTANCE") || !strcmp(type, "GLOBAL")) {
         if (layer_instance_list == NULL) {
-            layer_node = layer_node->next;
             goto out;
         }
         props = loader_get_next_layer_property_slot(inst, layer_instance_list);
@@ -1976,7 +1971,6 @@ static VkResult loader_read_layer_json(const struct loader_instance *inst, struc
             props->type_flags |= VK_LAYER_TYPE_FLAG_EXPLICIT_LAYER;
         }
     } else {
-        layer_node = layer_node->next;
         goto out;
     }
 
@@ -2063,7 +2057,6 @@ static VkResult loader_read_layer_json(const struct loader_instance *inst, struc
 
         temp = cJSON_Print(inst, library_path);
         if (NULL == temp) {
-            layer_node = layer_node->next;
             loader_log(inst, VULKAN_LOADER_WARN_BIT, 0,
                        "Problem accessing layer value library_path in manifest JSON file, skipping this layer");
             result = VK_ERROR_OUT_OF_HOST_MEMORY;
@@ -2228,7 +2221,6 @@ static VkResult loader_read_layer_json(const struct loader_instance *inst, struc
         if (!disable_environment || !disable_environment->child) {
             loader_log(inst, VULKAN_LOADER_WARN_BIT, 0,
                        "Didn't find required layer child value disable_environment in manifest JSON file, skipping this layer");
-            layer_node = layer_node->next;
             goto out;
         }
         strncpy(props->disable_env_var.name, disable_environment->child->string, sizeof(props->disable_env_var.name));