postgres.git / summary / log / commit / refs

commit    b705d639146ce994a52a65db0c4e263aab312bde
Author:   Tom Lane <tgl@sss.pgh.pa.us>
Date:     Thu Nov 07 19:21:52 2019 +0000
First released in: 13.0, 9.4.25, 9.5.20, 9.6.16, 10.11, 11.6, 12.1

    Move declaration of ecpg_gettext() to a saner place.
    
    Declaring this in the client-visible header ecpglib.h was a pretty
    poor decision.  It's not meant to be application-callable (and if
    it was, putting it outside the extern "C" { ... } wrapper means
    that C++ clients would fail to call it).  And the declaration would
    not even compile for a client, anyway, since it would not have the
    macro pg_attribute_format_arg().  Fortunately, it seems that no
    clients have tried to include this header with ENABLE_NLS defined,
    or we'd have gotten complaints about that.  But we have no business
    putting such a restriction on client code.
    
    Move the declaration to ecpglib_extern.h, since in fact nothing
    outside src/interfaces/ecpg/ecpglib/ needs to call it.
    
    The practical effect of this is just that clients can now safely
    #include ecpglib.h while having ENABLE_NLS defined, but that seems
    like enough of a reason to back-patch it.
    
    Discussion: https://postgr.es/m/20590.1573069709@sss.pgh.pa.us


src/interfaces/ecpg/ecpglib/extern.h | 6 ++++++ src/interfaces/ecpg/include/ecpglib.h | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/interfaces/ecpg/ecpglib/extern.h b/src/interfaces/ecpg/ecpglib/extern.h index 8b5cf588000..9eb354dff2a 100644 --- a/src/interfaces/ecpg/ecpglib/extern.h +++ b/src/interfaces/ecpg/ecpglib/extern.h @@ -205,6 +205,12 @@ void ecpg_set_compat_sqlda(int, struct sqlda_compat **, const PGresult *, int, struct sqlda_struct *ecpg_build_native_sqlda(int, PGresult *, int, enum COMPAT_MODE); void ecpg_set_native_sqlda(int, struct sqlda_struct **, const PGresult *, int, enum COMPAT_MODE); +#ifdef ENABLE_NLS +extern char *ecpg_gettext(const char *msgid) pg_attribute_format_arg(1); +#else +#define ecpg_gettext(x) (x) +#endif + /* SQLSTATE values generated or processed by ecpglib (intentionally * not exported -- users should refer to the codes directly) */ diff --git a/src/interfaces/ecpg/include/ecpglib.h b/src/interfaces/ecpg/include/ecpglib.h index c32df6c5d58..b93a11c1b7d 100644 --- a/src/interfaces/ecpg/include/ecpglib.h +++ b/src/interfaces/ecpg/include/ecpglib.h @@ -12,12 +12,6 @@ #include "sqlca.h" #include <string.h> -#ifdef ENABLE_NLS -extern char *ecpg_gettext(const char *msgid) pg_attribute_format_arg(1); -#else -#define ecpg_gettext(x) (x) -#endif - #ifndef __cplusplus #ifndef bool #define bool char [parent: 84780d468023]