From: | Phil Sorber <phil(at)omniti(dot)com> |
---|---|
To: | PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | get_progname() should not be const char *? |
Date: | 2013-02-04 23:26:53 |
Message-ID: | CADAkt-jhCbyOL8a4UZ_FLeGgKMnddC79uMJkA45Gqey4VZr6tA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
get_progname() returns a strdup()'d value. Shouldn't it then be simply
char * and not const char *? Otherwise free() complains loudly without
a cast.
diff --git a/src/include/port.h b/src/include/port.h
new file mode 100644
index 99d3a9b..2d6a435
*** a/src/include/port.h
--- b/src/include/port.h
*************** extern void make_native_path(char *path)
*** 45,51 ****
extern bool path_contains_parent_reference(const char *path);
extern bool path_is_relative_and_below_cwd(const char *path);
extern bool path_is_prefix_of_path(const char *path1, const char *path2);
! extern const char *get_progname(const char *argv0);
extern void get_share_path(const char *my_exec_path, char *ret_path);
extern void get_etc_path(const char *my_exec_path, char *ret_path);
extern void get_include_path(const char *my_exec_path, char *ret_path);
--- 45,51 ----
extern bool path_contains_parent_reference(const char *path);
extern bool path_is_relative_and_below_cwd(const char *path);
extern bool path_is_prefix_of_path(const char *path1, const char *path2);
! extern char *get_progname(const char *argv0);
extern void get_share_path(const char *my_exec_path, char *ret_path);
extern void get_etc_path(const char *my_exec_path, char *ret_path);
extern void get_include_path(const char *my_exec_path, char *ret_path);
diff --git a/src/port/path.c b/src/port/path.c
new file mode 100644
index 72ca24c..ebfc94c
*** a/src/port/path.c
--- b/src/port/path.c
*************** path_is_prefix_of_path(const char *path1
*** 411,417 ****
* Extracts the actual name of the program as called -
* stripped of .exe suffix if any
*/
! const char *
get_progname(const char *argv0)
{
const char *nodir_name;
--- 411,417 ----
* Extracts the actual name of the program as called -
* stripped of .exe suffix if any
*/
! char *
get_progname(const char *argv0)
{
const char *nodir_name;
From | Date | Subject | |
---|---|---|---|
Next Message | Hannu Krosing | 2013-02-04 23:42:45 | Re: json api WIP patch |
Previous Message | Alvaro Herrera | 2013-02-04 22:50:45 | palloc unification |