Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit568b801

Browse files
committed
Move set_pglocale_pgservice() from path.c to exec.c, so that pulling in
path.c does not in itself force linking of both exec.c and libintl.Should fix current ecpglib build failure on pickier platforms.
1 parent7ce2ff2 commit568b801

File tree

4 files changed

+66
-63
lines changed

4 files changed

+66
-63
lines changed

‎src/include/port.h

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,20 @@
66
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $PostgreSQL: pgsql/src/include/port.h,v 1.97 2006/08/30 18:06:27 tgl Exp $
9+
* $PostgreSQL: pgsql/src/include/port.h,v 1.98 2006/09/11 20:10:30 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
1313

14-
#include<pwd.h>
15-
#include<netdb.h>
16-
1714
#include<ctype.h>
15+
#include<netdb.h>
16+
#include<pwd.h>
1817

1918
/* non-blocking */
2019
externboolpg_set_noblock(intsock);
2120
externboolpg_set_block(intsock);
2221

23-
/* Portable path handling for Unix/Win32 */
22+
/* Portable path handling for Unix/Win32(in path.c)*/
2423

2524
externchar*first_dir_separator(constchar*filename);
2625
externchar*last_dir_separator(constchar*filename);
@@ -42,15 +41,13 @@ extern void get_pkglib_path(const char *my_exec_path, char *ret_path);
4241
externvoidget_locale_path(constchar*my_exec_path,char*ret_path);
4342
externvoidget_doc_path(constchar*my_exec_path,char*ret_path);
4443
externvoidget_man_path(constchar*my_exec_path,char*ret_path);
45-
externvoidset_pglocale_pgservice(constchar*argv0,constchar*app);
4644
externboolget_home_path(char*ret_path);
4745
externvoidget_parent_directory(char*path);
4846

4947
/*
5048
*is_absolute_path
5149
*
52-
*By making this a macro we prevent the need for libpq to include
53-
*path.c which uses exec.c.
50+
*By making this a macro we avoid needing to include path.c in libpq.
5451
*/
5552
#ifndefWIN32
5653
#defineis_absolute_path(filename) \
@@ -67,8 +64,10 @@ extern void get_parent_directory(char *path);
6764
)
6865
#endif
6966

67+
/* Portable locale initialization (in exec.c) */
68+
externvoidset_pglocale_pgservice(constchar*argv0,constchar*app);
7069

71-
/* Portable way to find binaries */
70+
/* Portable way to find binaries(in exec.c)*/
7271
externintfind_my_exec(constchar*argv0,char*retpath);
7372
externintfind_other_exec(constchar*argv0,constchar*target,
7473
constchar*versionstr,char*retpath);

‎src/interfaces/ecpg/ecpglib/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Copyright (c) 1994, Regents of the University of California
66
#
7-
# $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/Makefile,v 1.42 2006/09/10 22:07:02 tgl Exp $
7+
# $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/Makefile,v 1.43 2006/09/11 20:10:30 tgl Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -26,7 +26,7 @@ override CFLAGS += $(PTHREAD_CFLAGS)
2626
LIBS :=$(filter-out -lpgport,$(LIBS))
2727

2828
OBJS= execute.o typename.o descriptor.o data.o error.o prepare.o memory.o\
29-
connect.o misc.o path.oexec.o\
29+
connect.o misc.o path.o\
3030
$(filter snprintf.o,$(LIBOBJS))
3131

3232
# thread.c is needed only for non-WIN32 implementation of path.c
@@ -51,7 +51,7 @@ include $(top_srcdir)/src/Makefile.shlib
5151
# necessarily use the same object files as the backend uses. Instead,
5252
# symlink the source files in here and build our own object file.
5353

54-
path.cexec.csnprintf.cthread.c:% :$(top_srcdir)/src/port/%
54+
path.csnprintf.cthread.c:% :$(top_srcdir)/src/port/%
5555
rm -f$@&&$(LN_S)$<.
5656

5757
path.o: path.c$(top_builddir)/src/port/pg_config_paths.h
@@ -67,7 +67,7 @@ installdirs:
6767
uninstall: uninstall-lib
6868

6969
cleandistcleanmaintainer-clean: clean-lib
70-
rm -f$(OBJS) path.cexec.csnprintf.c thread.c
70+
rm -f$(OBJS) path.c snprintf.c thread.c
7171

7272
dependdep:
7373
$(CC) -MM$(CFLAGS)*.c>depend

‎src/port/exec.c

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/port/exec.c,v 1.42 2006/06/07 22:24:46 momjian Exp $
12+
* $PostgreSQL: pgsql/src/port/exec.c,v 1.43 2006/09/11 20:10:30 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -590,3 +590,55 @@ pclose_check(FILE *stream)
590590

591591
return-1;
592592
}
593+
594+
595+
/*
596+
*set_pglocale_pgservice
597+
*
598+
*Set application-specific locale and service directory
599+
*
600+
*This function takes the value of argv[0] rather than a full path.
601+
*
602+
* (You may be wondering why this is in exec.c. It requires this module's
603+
* services and doesn't introduce any new dependencies, so this seems as
604+
* good as anyplace.)
605+
*/
606+
void
607+
set_pglocale_pgservice(constchar*argv0,constchar*app)
608+
{
609+
charpath[MAXPGPATH];
610+
charmy_exec_path[MAXPGPATH];
611+
charenv_path[MAXPGPATH+sizeof("PGSYSCONFDIR=")];/* longer than
612+
* PGLOCALEDIR */
613+
614+
/* don't set LC_ALL in the backend */
615+
if (strcmp(app,"postgres")!=0)
616+
setlocale(LC_ALL,"");
617+
618+
if (find_my_exec(argv0,my_exec_path)<0)
619+
return;
620+
621+
#ifdefENABLE_NLS
622+
get_locale_path(my_exec_path,path);
623+
bindtextdomain(app,path);
624+
textdomain(app);
625+
626+
if (getenv("PGLOCALEDIR")==NULL)
627+
{
628+
/* set for libpq to use */
629+
snprintf(env_path,sizeof(env_path),"PGLOCALEDIR=%s",path);
630+
canonicalize_path(env_path+12);
631+
putenv(strdup(env_path));
632+
}
633+
#endif
634+
635+
if (getenv("PGSYSCONFDIR")==NULL)
636+
{
637+
get_etc_path(my_exec_path,path);
638+
639+
/* set for libpq to use */
640+
snprintf(env_path,sizeof(env_path),"PGSYSCONFDIR=%s",path);
641+
canonicalize_path(env_path+13);
642+
putenv(strdup(env_path));
643+
}
644+
}

‎src/port/path.c

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/port/path.c,v 1.66 2006/03/05 15:59:10 momjian Exp $
11+
* $PostgreSQL: pgsql/src/port/path.c,v 1.67 2006/09/11 20:10:30 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -652,54 +652,6 @@ get_parent_directory(char *path)
652652
}
653653

654654

655-
/*
656-
*set_pglocale_pgservice
657-
*
658-
*Set application-specific locale and service directory
659-
*
660-
*This function takes an argv[0] rather than a full path.
661-
*/
662-
void
663-
set_pglocale_pgservice(constchar*argv0,constchar*app)
664-
{
665-
charpath[MAXPGPATH];
666-
charmy_exec_path[MAXPGPATH];
667-
charenv_path[MAXPGPATH+sizeof("PGSYSCONFDIR=")];/* longer than
668-
* PGLOCALEDIR */
669-
670-
/* don't set LC_ALL in the backend */
671-
if (strcmp(app,"postgres")!=0)
672-
setlocale(LC_ALL,"");
673-
674-
if (find_my_exec(argv0,my_exec_path)<0)
675-
return;
676-
677-
#ifdefENABLE_NLS
678-
get_locale_path(my_exec_path,path);
679-
bindtextdomain(app,path);
680-
textdomain(app);
681-
682-
if (getenv("PGLOCALEDIR")==NULL)
683-
{
684-
/* set for libpq to use */
685-
snprintf(env_path,sizeof(env_path),"PGLOCALEDIR=%s",path);
686-
canonicalize_path(env_path+12);
687-
putenv(strdup(env_path));
688-
}
689-
#endif
690-
691-
if (getenv("PGSYSCONFDIR")==NULL)
692-
{
693-
get_etc_path(my_exec_path,path);
694-
695-
/* set for libpq to use */
696-
snprintf(env_path,sizeof(env_path),"PGSYSCONFDIR=%s",path);
697-
canonicalize_path(env_path+13);
698-
putenv(strdup(env_path));
699-
}
700-
}
701-
702-
703655
/*
704656
*trim_directory
705657
*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp