From: | Li Japin <japinli(at)hotmail(dot)com> |
---|---|
To: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Remove unnecessary else branch |
Date: | 2020-10-13 13:30:47 |
Message-ID: | 887E132F-5321-4572-AE74-1957BE6C6634@hotmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2020-10-13 13:36:54 | Re: Remove unnecessary else branch |
Previous Message | gkokolatos | 2020-10-13 13:28:02 | Re: PATCH: Attempt to make dbsize a bit more consistent |