Skip to content

Commit c8cb98e

Browse files
committed
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
1 parent b4bcc6b commit c8cb98e

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/interfaces/ecpg/ecpglib/ecpglib_extern.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,12 @@ unsigned ecpg_hex_dec_len(unsigned srclen);
219219
unsigned ecpg_hex_enc_len(unsigned srclen);
220220
unsigned ecpg_hex_encode(const char *src, unsigned len, char *dst);
221221

222+
#ifdef ENABLE_NLS
223+
extern char *ecpg_gettext(const char *msgid) pg_attribute_format_arg(1);
224+
#else
225+
#define ecpg_gettext(x) (x)
226+
#endif
227+
222228
/* SQLSTATE values generated or processed by ecpglib (intentionally
223229
* not exported -- users should refer to the codes directly) */
224230

src/interfaces/ecpg/include/ecpglib.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@
1212
#include "sqlca.h"
1313
#include <string.h>
1414

15-
#ifdef ENABLE_NLS
16-
extern char *ecpg_gettext(const char *msgid) pg_attribute_format_arg(1);
17-
#else
18-
#define ecpg_gettext(x) (x)
19-
#endif
20-
2115
#ifndef __cplusplus
2216
#ifndef bool
2317
#define bool char

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy