Remove unnecessary else branch

Поиск
Список
Период
Сортировка
От Li Japin
Тема Remove unnecessary else branch
Дата
Msg-id 887E132F-5321-4572-AE74-1957BE6C6634@hotmail.com
обсуждение исходный текст
Ответы Re: Remove unnecessary else branch  (Heikki Linnakangas <hlinnaka@iki.fi>)
Список pgsql-hackers
Hi,

I found in guc-file.l we can omit the else branch in AbsoluteConfigLocation().

diff --git a/src/backend/utils/misc/guc-file.l b/src/backend/utils/misc/guc-file.l
index c98e220295..9d4b3d7236 100644
--- a/src/backend/utils/misc/guc-file.l
+++ b/src/backend/utils/misc/guc-file.l
@@ -522,23 +522,21 @@ AbsoluteConfigLocation(const char *location, const char *calling_file)

        if (is_absolute_path(location))
                return pstrdup(location);
+
+       if (calling_file != NULL)
+       {
+               strlcpy(abs_path, calling_file, sizeof(abs_path));
+               get_parent_directory(abs_path);
+               join_path_components(abs_path, abs_path, location);
+               canonicalize_path(abs_path);
+       }
        else
        {
-               if (calling_file != NULL)
-               {
-                       strlcpy(abs_path, calling_file, sizeof(abs_path));
-                       get_parent_directory(abs_path);
-                       join_path_components(abs_path, abs_path, location);
-                       canonicalize_path(abs_path);
-               }
-               else
-               {
-                       AssertState(DataDir);
-                       join_path_components(abs_path, DataDir, location);
-                       canonicalize_path(abs_path);
-               }
-               return pstrdup(abs_path);
+               AssertState(DataDir);
+               join_path_components(abs_path, DataDir, location);
+               canonicalize_path(abs_path);
        }
+       return pstrdup(abs_path);
 }


--
Best regards
Japin Li






В списке pgsql-hackers по дате отправления:

Предыдущее
От: gkokolatos@pm.me
Дата:
Сообщение: Re: PATCH: Attempt to make dbsize a bit more consistent
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Remove unnecessary else branch