aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTatsuo Ishii <ishii@postgresql.org>2002-08-29 07:22:30 +0000
committerTatsuo Ishii <ishii@postgresql.org>2002-08-29 07:22:30 +0000
commited7baeaf4df676489106ab761936cdae9ffb7228 (patch)
tree91908d828af2d2c6e4bd96374d932cec73aaf01d /src
parent8e80dbb849cc63f6652a5fc645fa4d1e136c3c4c (diff)
downloadpostgresql-ed7baeaf4df676489106ab761936cdae9ffb7228.tar.gz
postgresql-ed7baeaf4df676489106ab761936cdae9ffb7228.zip
Remove #ifdef MULTIBYTE per hackers list discussion.
Diffstat (limited to 'src')
-rw-r--r--src/backend/commands/copy.c36
-rw-r--r--src/backend/commands/dbcommands.c8
-rw-r--r--src/backend/parser/analyze.c6
-rw-r--r--src/backend/parser/scan.l15
-rw-r--r--src/backend/postmaster/pgstat.c9
-rw-r--r--src/backend/regex/engine.c17
-rw-r--r--src/backend/regex/regcomp.c114
-rw-r--r--src/backend/regex/regerror.c5
-rw-r--r--src/backend/regex/regexec.c11
-rw-r--r--src/backend/regex/regfree.c3
-rw-r--r--src/backend/tcop/postgres.c6
-rw-r--r--src/backend/utils/adt/ascii.c44
-rw-r--r--src/backend/utils/adt/format_type.c9
-rw-r--r--src/backend/utils/adt/like.c44
-rw-r--r--src/backend/utils/adt/oracle_compat.c166
-rw-r--r--src/backend/utils/adt/quote.c100
-rw-r--r--src/backend/utils/adt/selfuncs.c6
-rw-r--r--src/backend/utils/adt/varchar.c80
-rw-r--r--src/backend/utils/adt/varlena.c10
-rw-r--r--src/backend/utils/error/elog.c8
-rw-r--r--src/backend/utils/init/postinit.c9
-rw-r--r--src/backend/utils/mb/mbutils.c33
-rw-r--r--src/include/regex/regex.h3
-rw-r--r--src/include/regex/regex2.h23
-rw-r--r--src/include/regex/utils.h4
-rw-r--r--src/include/utils/ascii.h5
-rw-r--r--src/include/utils/builtins.h6
-rw-r--r--src/interfaces/libpq/fe-connect.c25
-rw-r--r--src/interfaces/libpq/fe-misc.c23
-rw-r--r--src/interfaces/libpq/fe-print.c6
-rw-r--r--src/pl/plpgsql/src/pl_funcs.c8
31 files changed, 81 insertions, 761 deletions
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c
index b9eecf4b8be..56d40c5bf0f 100644
--- a/src/backend/commands/copy.c
+++ b/src/backend/commands/copy.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.168 2002/08/29 00:17:03 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.169 2002/08/29 07:22:21 ishii Exp $
*
*-------------------------------------------------------------------------
*/
@@ -39,10 +39,7 @@
#include "utils/relcache.h"
#include "utils/lsyscache.h"
#include "utils/syscache.h"
-
-#ifdef MULTIBYTE
#include "mb/pg_wchar.h"
-#endif
#define ISOCTAL(c) (((c) >= '0') && ((c) <= '7'))
#define OCTVALUE(c) ((c) - '0')
@@ -85,11 +82,8 @@ static bool fe_eof;
*/
static StringInfoData attribute_buf;
-#ifdef MULTIBYTE
static int client_encoding;
static int server_encoding;
-#endif
-
/*
* Internal communications functions
@@ -387,10 +381,9 @@ DoCopy(const CopyStmt *stmt)
* Set up variables to avoid per-attribute overhead.
*/
initStringInfo(&attribute_buf);
-#ifdef MULTIBYTE
+
client_encoding = pg_get_client_encoding();
server_encoding = GetDatabaseEncoding();
-#endif
if (is_from)
{ /* copy from file to database */
@@ -1231,14 +1224,12 @@ CopyReadAttribute(FILE *fp, const char *delim, CopyReadResult *result)
{
int c;
int delimc = (unsigned char) delim[0];
-#ifdef MULTIBYTE
int mblen;
unsigned char s[2];
char *cvt;
int j;
s[1] = 0;
-#endif
/* reset attribute_buf to empty */
attribute_buf.len = 0;
@@ -1354,7 +1345,7 @@ CopyReadAttribute(FILE *fp, const char *delim, CopyReadResult *result)
}
}
appendStringInfoCharMacro(&attribute_buf, c);
-#ifdef MULTIBYTE
+
/* XXX shouldn't this be done even when encoding is the same? */
if (client_encoding != server_encoding)
{
@@ -1372,12 +1363,10 @@ CopyReadAttribute(FILE *fp, const char *delim, CopyReadResult *result)
appendStringInfoCharMacro(&attribute_buf, c);
}
}
-#endif
}
copy_eof:
-#ifdef MULTIBYTE
if (client_encoding != server_encoding)
{
cvt = (char *) pg_client_to_server((unsigned char *) attribute_buf.data,
@@ -1391,7 +1380,6 @@ copy_eof:
pfree(cvt);
}
}
-#endif
return attribute_buf.data;
}
@@ -1403,14 +1391,11 @@ CopyAttributeOut(FILE *fp, char *server_string, char *delim)
char c;
char delimc = delim[0];
-#ifdef MULTIBYTE
bool same_encoding;
char *string_start;
int mblen;
int i;
-#endif
-#ifdef MULTIBYTE
same_encoding = (server_encoding == client_encoding);
if (!same_encoding)
{
@@ -1423,19 +1408,11 @@ CopyAttributeOut(FILE *fp, char *server_string, char *delim)
string = server_string;
string_start = NULL;
}
-#else
- string = server_string;
-#endif
-#ifdef MULTIBYTE
for (; (c = *string) != '\0'; string += mblen)
-#else
- for (; (c = *string) != '\0'; string++)
-#endif
{
-#ifdef MULTIBYTE
mblen = 1;
-#endif
+
switch (c)
{
case '\b':
@@ -1463,7 +1440,7 @@ CopyAttributeOut(FILE *fp, char *server_string, char *delim)
if (c == delimc)
CopySendChar('\\', fp);
CopySendChar(c, fp);
-#ifdef MULTIBYTE
+
/* XXX shouldn't this be done even when encoding is same? */
if (!same_encoding)
{
@@ -1472,15 +1449,12 @@ CopyAttributeOut(FILE *fp, char *server_string, char *delim)
for (i = 1; i < mblen; i++)
CopySendChar(string[i], fp);
}
-#endif
break;
}
}
-#ifdef MULTIBYTE
if (string_start)
pfree(string_start); /* pfree pg_server_to_client result */
-#endif
}
/*
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index 53c8391c0c5..c511199a8b4 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.99 2002/08/09 16:45:14 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.100 2002/08/29 07:22:21 ishii Exp $
*
*-------------------------------------------------------------------------
*/
@@ -39,9 +39,7 @@
#include "utils/lsyscache.h"
#include "utils/syscache.h"
-#ifdef MULTIBYTE
#include "mb/pg_wchar.h" /* encoding check */
-#endif
/* non-export function prototypes */
@@ -214,13 +212,9 @@ createdb(const CreatedbStmt *stmt)
if (encoding < 0)
encoding = src_encoding;
-#ifdef MULTIBYTE
/* Some encodings are client only */
if (!PG_VALID_BE_ENCODING(encoding))
elog(ERROR, "CREATE DATABASE: invalid backend encoding");
-#else
- Assert(encoding == 0); /* zero is PG_SQL_ASCII */
-#endif
/*
* Preassign OID for pg_database tuple, so that we can compute db
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c
index 514573b79a6..7abb2abfd60 100644
--- a/src/backend/parser/analyze.c
+++ b/src/backend/parser/analyze.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.245 2002/08/28 20:46:23 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.246 2002/08/29 07:22:22 ishii Exp $
*
*-------------------------------------------------------------------------
*/
@@ -42,9 +42,7 @@
#include "utils/lsyscache.h"
#include "utils/relcache.h"
#include "utils/syscache.h"
-#ifdef MULTIBYTE
#include "mb/pg_wchar.h"
-#endif
/* State shared by transformCreateSchemaStmt and its subroutines */
@@ -634,12 +632,10 @@ makeObjectName(char *name1, char *name2, char *typename)
name2chars--;
}
-#ifdef MULTIBYTE
if (name1)
name1chars = pg_mbcliplen(name1, name1chars, name1chars);
if (name2)
name2chars = pg_mbcliplen(name2, name2chars, name2chars);
-#endif
/* Now construct the string using the chosen lengths */
name = palloc(name1chars + name2chars + overhead + 1);
diff --git a/src/backend/parser/scan.l b/src/backend/parser/scan.l
index 5092f82e5e0..21534561ed2 100644
--- a/src/backend/parser/scan.l
+++ b/src/backend/parser/scan.l
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.100 2002/08/18 03:35:08 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.101 2002/08/29 07:22:23 ishii Exp $
*
*-------------------------------------------------------------------------
*/
@@ -26,10 +26,7 @@
#include "parser/keywords.h"
#include "parser/parse.h"
#include "utils/builtins.h"
-
-#ifdef MULTIBYTE
#include "mb/pg_wchar.h"
-#endif
/* No reason to constrain amount of data slurped */
#define YY_READ_BUF_SIZE 16777216
@@ -402,12 +399,9 @@ other .
if (literallen >= NAMEDATALEN)
{
int len;
-#ifdef MULTIBYTE
+
len = pg_mbcliplen(literalbuf, literallen,
NAMEDATALEN-1);
-#else
- len = NAMEDATALEN-1;
-#endif
elog(NOTICE, "identifier \"%s\" will be truncated to \"%.*s\"",
literalbuf, len, literalbuf);
literalbuf[len] = '\0';
@@ -562,11 +556,8 @@ other .
if (i >= NAMEDATALEN)
{
int len;
-#ifdef MULTIBYTE
+
len = pg_mbcliplen(ident, i, NAMEDATALEN-1);
-#else
- len = NAMEDATALEN-1;
-#endif
elog(NOTICE, "identifier \"%s\" will be truncated to \"%.*s\"",
ident, len, ident);
ident[len] = '\0';
diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c
index 7da055179d1..c5aacab95b1 100644
--- a/src/backend/postmaster/pgstat.c
+++ b/src/backend/postmaster/pgstat.c
@@ -16,7 +16,7 @@
*
* Copyright (c) 2001, PostgreSQL Global Development Group
*
- * $Header: /cvsroot/pgsql/src/backend/postmaster/pgstat.c,v 1.23 2002/08/04 05:09:36 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/postmaster/pgstat.c,v 1.24 2002/08/29 07:22:23 ishii Exp $
* ----------
*/
#include "postgres.h"
@@ -38,9 +38,7 @@
#include "catalog/pg_shadow.h"
#include "catalog/pg_database.h"
#include "libpq/pqsignal.h"
-#ifdef MULTIBYTE
#include "mb/pg_wchar.h"
-#endif
#include "miscadmin.h"
#include "utils/memutils.h"
#include "storage/backendid.h"
@@ -434,12 +432,7 @@ pgstat_report_activity(char *what)
return;
len = strlen(what);
-#ifdef MULTIBYTE
len = pg_mbcliplen((const unsigned char *)what, len, PGSTAT_ACTIVITY_SIZE - 1);
-#else
- if (len >= PGSTAT_ACTIVITY_SIZE)
- len = PGSTAT_ACTIVITY_SIZE - 1;
-#endif
memcpy(msg.m_what, what, len);
msg.m_what[len] = '\0';
diff --git a/src/backend/regex/engine.c b/src/backend/regex/engine.c
index 7e77054eecf..4a64ec8c992 100644
--- a/src/backend/regex/engine.c
+++ b/src/backend/regex/engine.c
@@ -108,13 +108,8 @@ static states step(struct re_guts * g, sopno start,
#define EOW (BOL+5)
#define CODEMAX (BOL+5) /* highest code used */
-#ifdef MULTIBYTE
#define NONCHAR(c) ((c) > 16777216) /* 16777216 == 2^24 == 3 bytes */
#define NNONCHAR (CODEMAX-16777216)
-#else
-#define NONCHAR(c) ((c) > CHAR_MAX)
-#define NNONCHAR (CODEMAX-CHAR_MAX)
-#endif
#ifdef REDEBUG
static void print(struct match * m, pg_wchar *caption, states st, int ch,
@@ -168,11 +163,7 @@ matcher(struct re_guts * g, pg_wchar *string, size_t nmatch,
else
{
start = string;
-#ifdef MULTIBYTE
stop = start + pg_wchar_strlen(start);
-#else
- stop = start + strlen(start);
-#endif
}
if (stop < start)
return REG_INVARG;
@@ -182,11 +173,7 @@ matcher(struct re_guts * g, pg_wchar *string, size_t nmatch,
{
for (dp = start; dp < stop; dp++)
if (*dp == g->must[0] && stop - dp >= g->mlen &&
-#ifdef MULTIBYTE
memcmp(dp, g->must, (size_t) (g->mlen * sizeof(pg_wchar))) == 0
-#else
- memcmp(dp, g->must, (size_t) g->mlen) == 0
-#endif
)
break;
if (dp == stop) /* we didn't find g->must */
@@ -1090,11 +1077,7 @@ pchar(int ch)
static int
pg_isprint(int c)
{
-#ifdef MULTIBYTE
return (c >= 0 && c <= UCHAR_MAX && isprint((unsigned char) c));
-#else
- return (isprint((unsigned char) c));
-#endif
}
#endif
#endif
diff --git a/src/backend/regex/regcomp.c b/src/backend/regex/regcomp.c
index d6f7b26fa1a..ae079ff4c4d 100644
--- a/src/backend/regex/regcomp.c
+++ b/src/backend/regex/regcomp.c
@@ -91,13 +91,7 @@ static void p_b_cclass(struct parse * p, cset *cs);
static void p_b_eclass(struct parse * p, cset *cs);
static pg_wchar p_b_symbol(struct parse * p);
static char p_b_coll_elem(struct parse * p, int endc);
-
-#ifdef MULTIBYTE
static unsigned char othercase(int ch);
-
-#else
-static char othercase(int ch);
-#endif
static void bothcases(struct parse * p, int ch);
static void ordinary(struct parse * p, int ch);
static void nonnewline(struct parse * p);
@@ -184,10 +178,7 @@ pg_regcomp(regex_t *preg, const char *pattern, int cflags)
struct parse *p = &pa;
int i;
size_t len;
-
-#ifdef MULTIBYTE
pg_wchar *wcp;
-#endif
if ( cclasses == NULL )
cclasses = cclass_init();
@@ -204,29 +195,19 @@ pg_regcomp(regex_t *preg, const char *pattern, int cflags)
if (cflags & REG_PEND)
{
-#ifdef MULTIBYTE
wcp = preg->patsave;
if (preg->re_endp < wcp)
return REG_INVARG;
len = preg->re_endp - wcp;
-#else
- if (preg->re_endp < pattern)
- return REG_INVARG;
- len = preg->re_endp - pattern;
-#endif
}
else
{
-#ifdef MULTIBYTE
wcp = (pg_wchar *) malloc((strlen(pattern) + 1) * sizeof(pg_wchar));
if (wcp == NULL)
return REG_ESPACE;
preg->patsave = wcp;
(void) pg_mb2wchar((unsigned char *) pattern, wcp);
len = pg_wchar_strlen(wcp);
-#else
- len = strlen((char *) pattern);
-#endif
}
/* do the mallocs early so failure handling is easy */
@@ -246,12 +227,7 @@ pg_regcomp(regex_t *preg, const char *pattern, int cflags)
/* set things up */
p->g = g;
-#ifdef MULTIBYTE
p->next = wcp;
-#else
- p->next = (pg_wchar *) pattern; /* convenience; we do not modify
- * it */
-#endif
p->end = p->next + len;
p->error = 0;
p->ncsalloc = 0;
@@ -591,11 +567,7 @@ p_simp_re(struct parse * p,
if (c == '\\')
{
REQUIRE(MORE(), REG_EESCAPE);
-#ifdef MULTIBYTE
c = BACKSL | (pg_wchar) GETNEXT();
-#else
- c = BACKSL | (unsigned char) GETNEXT();
-#endif
}
switch (c)
{
@@ -736,27 +708,17 @@ p_bracket(struct parse * p)
cset *cs = allocset(p);
int invert = 0;
-#ifdef MULTIBYTE
pg_wchar sp1[] = {'[', ':', '<', ':', ']', ']'};
pg_wchar sp2[] = {'[', ':', '>', ':', ']', ']'};
-#endif
/* Dept of Truly Sickening Special-Case Kludges */
-#ifdef MULTIBYTE
if (p->next + 5 < p->end && pg_wchar_strncmp(p->next, sp1, 6) == 0)
-#else
- if (p->next + 5 < p->end && strncmp(p->next, "[:<:]]", 6) == 0)
-#endif
{
EMIT(OBOW, 0);
NEXTn(6);
return;
}
-#ifdef MULTIBYTE
if (p->next + 5 < p->end && pg_wchar_strncmp(p->next, sp2, 6) == 0)
-#else
- if (p->next + 5 < p->end && strncmp(p->next, "[:>:]]", 6) == 0)
-#endif
{
EMIT(OEOW, 0);
NEXTn(6);
@@ -881,10 +843,10 @@ p_b_term(struct parse * p, cset *cs)
finish = start;
/* xxx what about signed chars here... */
REQUIRE(start <= finish, REG_ERANGE);
-#ifdef MULTIBYTE
+
if (CHlc(start) != CHlc(finish))
SETERROR(REG_ERANGE);
-#endif
+
for (i = start; i <= finish; i++)
CHadd(cs, i);
break;
@@ -906,13 +868,11 @@ p_b_cclass(struct parse * p, cset *cs)
while (MORE() && pg_isalpha(PEEK()))
NEXT();
len = p->next - sp;
+
for (cp = cclasses; cp->name != NULL; cp++)
-#ifdef MULTIBYTE
if (pg_char_and_wchar_strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
-#else
- if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
-#endif
break;
+
if (cp->name == NULL)
{
/* oops, didn't find it */
@@ -977,13 +937,11 @@ p_b_coll_elem(struct parse * p, int endc)
return 0;
}
len = p->next - sp;
+
for (cp = cnames; cp->name != NULL; cp++)
-#ifdef MULTIBYTE
if (pg_char_and_wchar_strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
-#else
- if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
-#endif
return cp->code; /* known name */
+
if (len == 1)
return *sp; /* single character */
SETERROR(REG_ECOLLATE); /* neither */
@@ -993,33 +951,17 @@ p_b_coll_elem(struct parse * p, int endc)
/*
* othercase - return the case counterpart of an alphabetic
*/
-#ifdef MULTIBYTE
static unsigned char /* if no counterpart, return ch */
-#else
-static char /* if no counterpart, return ch */
-#endif
othercase(int ch)
{
assert(pg_isalpha(ch));
if (pg_isupper(ch))
-#ifdef MULTIBYTE
return (unsigned char) tolower((unsigned char) ch);
-#else
- return tolower((unsigned char) ch);
-#endif
else if (pg_islower(ch))
-#ifdef MULTIBYTE
return (unsigned char) toupper((unsigned char) ch);
-#else
- return toupper((unsigned char) ch);
-#endif
else
/* peculiar, but could happen */
-#ifdef MULTIBYTE
return (unsigned char) ch;
-#else
- return ch;
-#endif
}
/*
@@ -1058,11 +1000,7 @@ ordinary(struct parse * p, int ch)
bothcases(p, ch);
else
{
-#ifdef MULTIBYTE
EMIT(OCHAR, (pg_wchar) ch);
-#else
- EMIT(OCHAR, (unsigned char) ch);
-#endif
if (ch >= CHAR_MIN && ch <= CHAR_MAX && cap[ch] == 0)
cap[ch] = p->g->ncategories++;
}
@@ -1633,11 +1571,7 @@ findmust(struct parse * p, struct re_guts * g)
return;
/* turn it into a character string */
-#ifdef MULTIBYTE
g->must = (pg_wchar *) malloc((size_t) (g->mlen + 1) * sizeof(pg_wchar));
-#else
- g->must = malloc((size_t) g->mlen + 1);
-#endif
if (g->must == NULL)
{ /* argh; just forget it */
g->mlen = 0;
@@ -1697,91 +1631,55 @@ pluscount(struct parse * p, struct re_guts * g)
static int
pg_isdigit(int c)
{
-#ifdef MULTIBYTE
return (c >= 0 && c <= UCHAR_MAX && isdigit((unsigned char) c));
-#else
- return (isdigit((unsigned char) c));
-#endif
}
static int
pg_isalpha(int c)
{
-#ifdef MULTIBYTE
return (c >= 0 && c <= UCHAR_MAX && isalpha((unsigned char) c));
-#else
- return (isalpha((unsigned char) c));
-#endif
}
static int
pg_isalnum(int c)
{
-#ifdef MULTIBYTE
return (c >= 0 && c <= UCHAR_MAX && isalnum((unsigned char) c));
-#else
- return (isalnum((unsigned char) c));
-#endif
}
static int
pg_isupper(int c)
{
-#ifdef MULTIBYTE
return (c >= 0 && c <= UCHAR_MAX && isupper((unsigned char) c));
-#else
- return (isupper((unsigned char) c));
-#endif
}
static int
pg_islower(int c)
{
-#ifdef MULTIBYTE
return (c >= 0 && c <= UCHAR_MAX && islower((unsigned char) c));
-#else
- return (islower((unsigned char) c));
-#endif
}
static int
pg_iscntrl(int c)
{
-#ifdef MULTIBYTE
return (c >= 0 && c <= UCHAR_MAX && iscntrl((unsigned char) c));
-#else
- return (iscntrl((unsigned char) c));
-#endif
}
static int
pg_isgraph(int c)
{
-#ifdef MULTIBYTE
return (c >= 0 && c <= UCHAR_MAX && isgraph((unsigned char) c));
-#else
- return (isgraph((unsigned char) c));
-#endif
}
static int
pg_isprint(int c)
{
-#ifdef MULTIBYTE
return (c >= 0 && c <= UCHAR_MAX && isprint((unsigned char) c));
-#else
- return (isprint((unsigned char) c));
-#endif
}
static int
pg_ispunct(int c)
{
-#ifdef MULTIBYTE
return (c >= 0 && c <= UCHAR_MAX && ispunct((unsigned char) c));
-#else
- return (ispunct((unsigned char) c));
-#endif
}
static struct cclass *
diff --git a/src/backend/regex/regerror.c b/src/backend/regex/regerror.c
index fb12cba3048..b3d1d472dfb 100644
--- a/src/backend/regex/regerror.c
+++ b/src/backend/regex/regerror.c
@@ -171,12 +171,9 @@ regatoi(const regex_t *preg, char *localbuf)
struct rerr *r;
for (r = rerrs; r->code != 0; r++)
-#ifdef MULTIBYTE
if (pg_char_and_wchar_strcmp(r->name, preg->re_endp) == 0)
-#else
- if (strcmp(r->name, preg->re_endp) == 0)
-#endif
break;
+
if (r->code == 0)
return "0";
diff --git a/src/backend/regex/regexec.c b/src/backend/regex/regexec.c
index 06459ef1dbc..59c9ede9f7c 100644
--- a/src/backend/regex/regexec.c
+++ b/src/backend/regex/regexec.c
@@ -154,10 +154,8 @@ pg_regexec(const regex_t *preg, const char *string, size_t nmatch,
{
struct re_guts *g = preg->re_g;
-#ifdef MULTIBYTE
pg_wchar *str;
int sts;
-#endif
#ifdef REDEBUG
#define GOODFLAGS(f) (f)
@@ -172,7 +170,6 @@ pg_regexec(const regex_t *preg, const char *string, size_t nmatch,
return REG_BADPAT;
eflags = GOODFLAGS(eflags);
-#ifdef MULTIBYTE
str = (pg_wchar *) malloc((strlen(string) + 1) * sizeof(pg_wchar));
if (!str)
return (REG_ESPACE);
@@ -183,12 +180,4 @@ pg_regexec(const regex_t *preg, const char *string, size_t nmatch,
sts = lmatcher(g, str, nmatch, pmatch, eflags);
free((char *) str);
return (sts);
-
-#else
-
- if (g->nstates <= CHAR_BIT * sizeof(states1) && !(eflags & REG_LARGE))
- return smatcher(g, (pg_wchar *) string, nmatch, pmatch, eflags);
- else
- return lmatcher(g, (pg_wchar *) string, nmatch, pmatch, eflags);
-#endif
}
diff --git a/src/backend/regex/regfree.c b/src/backend/regex/regfree.c
index 5672fcf240f..b022dddc75a 100644
--- a/src/backend/regex/regfree.c
+++ b/src/backend/regex/regfree.c
@@ -61,10 +61,9 @@ pg_regfree(regex_t *preg)
return;
preg->re_magic = 0; /* mark it invalid */
g->magic = 0; /* mark it invalid */
-#ifdef MULTIBYTE
+
if (preg->patsave != NULL)
free((char *) preg->patsave);
-#endif
if (g->strip != NULL)
free((char *) g->strip);
if (g->sets != NULL)
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 28576b8fad6..d16edabfe3f 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.284 2002/08/27 04:55:11 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.285 2002/08/29 07:22:23 ishii Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
@@ -57,9 +57,7 @@
#include "utils/guc.h"
#include "utils/memutils.h"
#include "utils/ps_status.h"
-#ifdef MULTIBYTE
#include "mb/pg_wchar.h"
-#endif
#include "pgstat.h"
@@ -1666,7 +1664,7 @@ PostgresMain(int argc, char *argv[], const char *username)
if (!IsUnderPostmaster)
{
puts("\nPOSTGRES backend interactive interface ");
- puts("$Revision: 1.284 $ $Date: 2002/08/27 04:55:11 $\n");
+ puts("$Revision: 1.285 $ $Date: 2002/08/29 07:22:23 $\n");
}
/*
diff --git a/src/backend/utils/adt/ascii.c b/src/backend/utils/adt/ascii.c
index a62672a5e53..0a2820721dc 100644
--- a/src/backend/utils/adt/ascii.c
+++ b/src/backend/utils/adt/ascii.c
@@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------
* ascii.c
*
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/ascii.c,v 1.12 2001/11/05 17:46:28 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/ascii.c,v 1.13 2002/08/29 07:22:26 ishii Exp $
*
* Portions Copyright (c) 1999-2000, PostgreSQL Global Development Group
*
@@ -18,46 +18,6 @@
#include "mb/pg_wchar.h"
#include "utils/ascii.h"
-/* ----------
- * even if MULTIBYTE is not enabled, these functions must exist
- * since pg_proc.h has references to them.
- * ----------
- */
-#ifndef MULTIBYTE
-
-static void multibyte_error(void);
-
-static void
-multibyte_error(void)
-{
- elog(ERROR, "Multi-byte support is not enabled");
-}
-
-Datum
-to_ascii_encname(PG_FUNCTION_ARGS)
-{
- multibyte_error();
- return 0; /* keep compiler quiet */
-}
-
-Datum
-to_ascii_enc(PG_FUNCTION_ARGS)
-{
- multibyte_error();
- return 0; /* keep compiler quiet */
-}
-
-Datum
-to_ascii_default(PG_FUNCTION_ARGS)
-{
- multibyte_error();
- return 0; /* keep compiler quiet */
-}
-
-
-#else /* with MULTIBYTE */
-
-
static text *encode_to_ascii(text *data, int enc);
/* ----------
@@ -190,5 +150,3 @@ to_ascii_default(PG_FUNCTION_ARGS)
)
);
}
-
-#endif /* MULTIBYTE */
diff --git a/src/backend/utils/adt/format_type.c b/src/backend/utils/adt/format_type.c
index 2aca3d7fc5f..02e0dc8f27d 100644
--- a/src/backend/utils/adt/format_type.c
+++ b/src/backend/utils/adt/format_type.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/format_type.c,v 1.32 2002/08/24 15:00:46 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/format_type.c,v 1.33 2002/08/29 07:22:26 ishii Exp $
*
*-------------------------------------------------------------------------
*/
@@ -25,9 +25,7 @@
#include "utils/numeric.h"
#include "utils/lsyscache.h"
#include "utils/syscache.h"
-#ifdef MULTIBYTE
#include "mb/pg_wchar.h"
-#endif
#define MAX_INT32_LEN 11
#define _textin(str) DirectFunctionCall1(textin, CStringGetDatum(str))
@@ -433,14 +431,11 @@ type_maximum_size(Oid type_oid, int32 typemod)
case BPCHAROID:
case VARCHAROID:
/* typemod includes varlena header */
-#ifdef MULTIBYTE
+
/* typemod is in characters not bytes */
return (typemod - VARHDRSZ) *
pg_encoding_max_length(GetDatabaseEncoding())
+ VARHDRSZ;
-#else
- return typemod;
-#endif
case NUMERICOID:
/* precision (ie, max # of digits) is in upper bits of typmod */
diff --git a/src/backend/utils/adt/like.c b/src/backend/utils/adt/like.c
index 1ce4de6d99a..3e67e947a9d 100644
--- a/src/backend/utils/adt/like.c
+++ b/src/backend/utils/adt/like.c
@@ -11,7 +11,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/like.c,v 1.50 2002/08/22 04:45:11 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/like.c,v 1.51 2002/08/29 07:22:26 ishii Exp $
*
*-------------------------------------------------------------------------
*/
@@ -19,9 +19,7 @@
#include <ctype.h>
-#ifdef MULTIBYTE
#include "mb/pg_wchar.h"
-#endif
#include "utils/builtins.h"
@@ -38,7 +36,6 @@ static int MatchBytea(unsigned char *t, int tlen,
unsigned char *p, int plen);
static text *do_like_escape(text *, text *);
-#ifdef MULTIBYTE
static int MBMatchText(unsigned char *t, int tlen,
unsigned char *p, int plen);
static int MBMatchTextIC(unsigned char *t, int tlen,
@@ -107,9 +104,7 @@ iwchareq(unsigned char *p1, unsigned char *p2)
c2[0] = tolower(c2[0]);
return (c1[0] == c2[0]);
}
-#endif
-#ifdef MULTIBYTE
#define CHAREQ(p1, p2) wchareq(p1, p2)
#define ICHAREQ(p1, p2) iwchareq(p1, p2)
#define NextChar(p, plen) \
@@ -132,7 +127,6 @@ iwchareq(unsigned char *p1, unsigned char *p2)
#undef MatchText
#undef MatchTextIC
#undef do_like_escape
-#endif
#define CHAREQ(p1, p2) (*(p1) == *(p2))
#define ICHAREQ(p1, p2) (tolower(*(p1)) == tolower(*(p2)))
@@ -164,14 +158,10 @@ namelike(PG_FUNCTION_ARGS)
p = VARDATA(pat);
plen = (VARSIZE(pat) - VARHDRSZ);
-#ifdef MULTIBYTE
if (pg_database_encoding_max_length() == 1)
result = (MatchText(s, slen, p, plen) == LIKE_TRUE);
else
result = (MBMatchText(s, slen, p, plen) == LIKE_TRUE);
-#else
- result = (MatchText(s, slen, p, plen) == LIKE_TRUE);
-#endif
PG_RETURN_BOOL(result);
}
@@ -192,14 +182,10 @@ namenlike(PG_FUNCTION_ARGS)
p = VARDATA(pat);
plen = (VARSIZE(pat) - VARHDRSZ);
-#ifdef MULTIBYTE
if (pg_database_encoding_max_length() == 1)
result = (MatchText(s, slen, p, plen) != LIKE_TRUE);
else
result = (MBMatchText(s, slen, p, plen) != LIKE_TRUE);
-#else
- result = (MatchText(s, slen, p, plen) != LIKE_TRUE);
-#endif
PG_RETURN_BOOL(result);
}
@@ -220,14 +206,10 @@ textlike(PG_FUNCTION_ARGS)
p = VARDATA(pat);
plen = (VARSIZE(pat) - VARHDRSZ);
-#ifdef MULTIBYTE
if (pg_database_encoding_max_length() == 1)
result = (MatchText(s, slen, p, plen) == LIKE_TRUE);
else
result = (MBMatchText(s, slen, p, plen) == LIKE_TRUE);
-#else
- result = (MatchText(s, slen, p, plen) == LIKE_TRUE);
-#endif
PG_RETURN_BOOL(result);
}
@@ -248,14 +230,10 @@ textnlike(PG_FUNCTION_ARGS)
p = VARDATA(pat);
plen = (VARSIZE(pat) - VARHDRSZ);
-#ifdef MULTIBYTE
if (pg_database_encoding_max_length() == 1)
result = (MatchText(s, slen, p, plen) != LIKE_TRUE);
else
result = (MBMatchText(s, slen, p, plen) != LIKE_TRUE);
-#else
- result = (MatchText(s, slen, p, plen) != LIKE_TRUE);
-#endif
PG_RETURN_BOOL(result);
}
@@ -322,14 +300,10 @@ nameiclike(PG_FUNCTION_ARGS)
p = VARDATA(pat);
plen = (VARSIZE(pat) - VARHDRSZ);
-#ifdef MULTIBYTE
if (pg_database_encoding_max_length() == 1)
result = (MatchTextIC(s, slen, p, plen) == LIKE_TRUE);
else
result = (MBMatchTextIC(s, slen, p, plen) == LIKE_TRUE);
-#else
- result = (MatchTextIC(s, slen, p, plen) == LIKE_TRUE);
-#endif
PG_RETURN_BOOL(result);
}
@@ -350,14 +324,10 @@ nameicnlike(PG_FUNCTION_ARGS)
p = VARDATA(pat);
plen = (VARSIZE(pat) - VARHDRSZ);
-#ifdef MULTIBYTE
if (pg_database_encoding_max_length() == 1)
result = (MatchTextIC(s, slen, p, plen) != LIKE_TRUE);
else
result = (MBMatchTextIC(s, slen, p, plen) != LIKE_TRUE);
-#else
- result = (MatchTextIC(s, slen, p, plen) != LIKE_TRUE);
-#endif
PG_RETURN_BOOL(result);
}
@@ -378,14 +348,10 @@ texticlike(PG_FUNCTION_ARGS)
p = VARDATA(pat);
plen = (VARSIZE(pat) - VARHDRSZ);
-#ifdef MULTIBYTE
if (pg_database_encoding_max_length() == 1)
result = (MatchTextIC(s, slen, p, plen) == LIKE_TRUE);
else
result = (MBMatchTextIC(s, slen, p, plen) == LIKE_TRUE);
-#else
- result = (MatchTextIC(s, slen, p, plen) == LIKE_TRUE);
-#endif
PG_RETURN_BOOL(result);
}
@@ -406,14 +372,10 @@ texticnlike(PG_FUNCTION_ARGS)
p = VARDATA(pat);
plen = (VARSIZE(pat) - VARHDRSZ);
-#ifdef MULTIBYTE
if (pg_database_encoding_max_length() == 1)
result = (MatchTextIC(s, slen, p, plen) != LIKE_TRUE);
else
result = (MBMatchTextIC(s, slen, p, plen) != LIKE_TRUE);
-#else
- result = (MatchTextIC(s, slen, p, plen) != LIKE_TRUE);
-#endif
PG_RETURN_BOOL(result);
}
@@ -429,14 +391,10 @@ like_escape(PG_FUNCTION_ARGS)
text *esc = PG_GETARG_TEXT_P(1);
text *result;
-#ifdef MULTIBYTE
if (pg_database_encoding_max_length() == 1)
result = do_like_escape(pat, esc);
else
result = MB_do_like_escape(pat, esc);
-#else
- result = do_like_escape(pat, esc);
-#endif
PG_RETURN_TEXT_P(result);
}
diff --git a/src/backend/utils/adt/oracle_compat.c b/src/backend/utils/adt/oracle_compat.c
index bd2d884b3fd..e71604719f7 100644
--- a/src/backend/utils/adt/oracle_compat.c
+++ b/src/backend/utils/adt/oracle_compat.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/oracle_compat.c,v 1.41 2002/08/22 05:05:19 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/oracle_compat.c,v 1.42 2002/08/29 07:22:27 ishii Exp $
*
*-------------------------------------------------------------------------
*/
@@ -20,9 +20,7 @@
#include "utils/builtins.h"
-#ifdef MULTIBYTE
#include "mb/pg_wchar.h"
-#endif
/********************************************************************
*
@@ -172,9 +170,7 @@ lpad(PG_FUNCTION_ARGS)
s1len,
s2len;
-#ifdef MULTIBYTE
int bytelen;
-#endif
/* Negative len is silently taken as zero */
if (len < 0)
@@ -188,16 +184,14 @@ lpad(PG_FUNCTION_ARGS)
if (s2len < 0)
s2len = 0; /* shouldn't happen */
-#ifdef MULTIBYTE
s1len = pg_mbstrlen_with_len(VARDATA(string1), s1len);
-#endif
+
if (s1len > len)
s1len = len; /* truncate string1 to len chars */
if (s2len <= 0)
len = s1len; /* nothing to pad with, so don't pad */
-#ifdef MULTIBYTE
bytelen = pg_database_encoding_max_length() * len;
/* check for integer overflow */
@@ -205,16 +199,13 @@ lpad(PG_FUNCTION_ARGS)
elog(ERROR, "Requested length too large");
ret = (text *) palloc(VARHDRSZ + bytelen);
-#else
- ret = (text *) palloc(VARHDRSZ + len);
-#endif
+
m = len - s1len;
ptr2 = VARDATA(string2);
ptr2end = ptr2 + s2len;
ptr_ret = VARDATA(ret);
-#ifdef MULTIBYTE
while (m--)
{
int mlen = pg_mblen(ptr2);
@@ -225,18 +216,9 @@ lpad(PG_FUNCTION_ARGS)
if (ptr2 == ptr2end) /* wrap around at end of s2 */
ptr2 = VARDATA(string2);
}
-#else
- while (m--)
- {
- *ptr_ret++ = *ptr2++;
- if (ptr2 == ptr2end) /* wrap around at end of s2 */
- ptr2 = VARDATA(string2);
- }
-#endif
ptr1 = VARDATA(string1);
-#ifdef MULTIBYTE
while (s1len--)
{
int mlen = pg_mblen(ptr1);
@@ -245,10 +227,6 @@ lpad(PG_FUNCTION_ARGS)
ptr_ret += mlen;
ptr1 += mlen;
}
-#else
- while (s1len--)
- *ptr_ret++ = *ptr1++;
-#endif
VARATT_SIZEP(ret) = ptr_ret - (char *) ret;
@@ -287,9 +265,7 @@ rpad(PG_FUNCTION_ARGS)
s1len,
s2len;
-#ifdef MULTIBYTE
int bytelen;
-#endif
/* Negative len is silently taken as zero */
if (len < 0)
@@ -303,9 +279,7 @@ rpad(PG_FUNCTION_ARGS)
if (s2len < 0)
s2len = 0; /* shouldn't happen */
-#ifdef MULTIBYTE
s1len = pg_mbstrlen_with_len(VARDATA(string1), s1len);
-#endif
if (s1len > len)
s1len = len; /* truncate string1 to len chars */
@@ -313,7 +287,6 @@ rpad(PG_FUNCTION_ARGS)
if (s2len <= 0)
len = s1len; /* nothing to pad with, so don't pad */
-#ifdef MULTIBYTE
bytelen = pg_database_encoding_max_length() * len;
/* Check for integer overflow */
@@ -321,15 +294,11 @@ rpad(PG_FUNCTION_ARGS)
elog(ERROR, "Requested length too large");
ret = (text *) palloc(VARHDRSZ + bytelen);
-#else
- ret = (text *) palloc(VARHDRSZ + len);
-#endif
m = len - s1len;
ptr1 = VARDATA(string1);
ptr_ret = VARDATA(ret);
-#ifdef MULTIBYTE
while (s1len--)
{
int mlen = pg_mblen(ptr1);
@@ -338,15 +307,10 @@ rpad(PG_FUNCTION_ARGS)
ptr_ret += mlen;
ptr1 += mlen;
}
-#else
- while (s1len--)
- *ptr_ret++ = *ptr1++;
-#endif
ptr2 = VARDATA(string2);
ptr2end = ptr2 + s2len;
-#ifdef MULTIBYTE
while (m--)
{
int mlen = pg_mblen(ptr2);
@@ -357,14 +321,6 @@ rpad(PG_FUNCTION_ARGS)
if (ptr2 == ptr2end) /* wrap around at end of s2 */
ptr2 = VARDATA(string2);
}
-#else
- while (m--)
- {
- *ptr_ret++ = *ptr2++;
- if (ptr2 == ptr2end) /* wrap around at end of s2 */
- ptr2 = VARDATA(string2);
- }
-#endif
VARATT_SIZEP(ret) = ptr_ret - (char *) ret;
@@ -399,13 +355,11 @@ btrim(PG_FUNCTION_ARGS)
*end2;
int m;
-#ifdef MULTIBYTE
char **mp;
int mplen;
char *p;
int mblen;
int len;
-#endif
if ((m = VARSIZE(string) - VARHDRSZ) <= 0 ||
(VARSIZE(set) - VARHDRSZ) <= 0)
@@ -413,7 +367,6 @@ btrim(PG_FUNCTION_ARGS)
ptr = VARDATA(string);
-#ifdef MULTIBYTE
len = m;
mp = (char **) palloc(len * sizeof(char *));
p = ptr;
@@ -428,12 +381,8 @@ btrim(PG_FUNCTION_ARGS)
len -= mblen;
}
mplen--;
-#else
- end = VARDATA(string) + VARSIZE(string) - VARHDRSZ - 1;
-#endif
end2 = VARDATA(set) + VARSIZE(set) - VARHDRSZ - 1;
-#ifdef MULTIBYTE
while (m > 0)
{
int str_len = pg_mblen(ptr);
@@ -475,37 +424,6 @@ btrim(PG_FUNCTION_ARGS)
m -= str_len;
}
pfree(mp);
-#else
- while (m > 0)
- {
- ptr2 = VARDATA(set);
- while (ptr2 <= end2)
- {
- if (*ptr == *ptr2)
- break;
- ++ptr2;
- }
- if (ptr2 > end2)
- break;
- ptr++;
- m--;
- }
-
- while (m > 0)
- {
- ptr2 = VARDATA(set);
- while (ptr2 <= end2)
- {
- if (*end == *ptr2)
- break;
- ++ptr2;
- }
- if (ptr2 > end2)
- break;
- end--;
- m--;
- }
-#endif
ret = (text *) palloc(VARHDRSZ + m);
VARATT_SIZEP(ret) = VARHDRSZ + m;
memcpy(VARDATA(ret), ptr, m);
@@ -619,7 +537,6 @@ ltrim(PG_FUNCTION_ARGS)
ptr = VARDATA(string);
end2 = VARDATA(set) + VARSIZE(set) - VARHDRSZ - 1;
-#ifdef MULTIBYTE
while (m > 0)
{
int str_len = pg_mblen(ptr);
@@ -639,22 +556,6 @@ ltrim(PG_FUNCTION_ARGS)
ptr += str_len;
m -= str_len;
}
-#else
- while (m > 0)
- {
- ptr2 = VARDATA(set);
- while (ptr2 <= end2)
- {
- if (*ptr == *ptr2)
- break;
- ++ptr2;
- }
- if (ptr2 > end2)
- break;
- ptr++;
- m--;
- }
-#endif
ret = (text *) palloc(VARHDRSZ + m);
VARATT_SIZEP(ret) = VARHDRSZ + m;
memcpy(VARDATA(ret), ptr, m);
@@ -691,13 +592,11 @@ rtrim(PG_FUNCTION_ARGS)
*end2;
int m;
-#ifdef MULTIBYTE
char **mp;
int mplen;
char *p;
int mblen;
int len;
-#endif
if ((m = VARSIZE(string) - VARHDRSZ) <= 0 ||
(VARSIZE(set) - VARHDRSZ) <= 0)
@@ -705,7 +604,6 @@ rtrim(PG_FUNCTION_ARGS)
ptr = VARDATA(string);
-#ifdef MULTIBYTE
len = m;
mp = (char **) palloc(len * sizeof(char *));
p = ptr;
@@ -720,12 +618,8 @@ rtrim(PG_FUNCTION_ARGS)
len -= mblen;
}
mplen--;
-#else
- end = VARDATA(string) + VARSIZE(string) - VARHDRSZ - 1;
-#endif
end2 = VARDATA(set) + VARSIZE(set) - VARHDRSZ - 1;
-#ifdef MULTIBYTE
while (m > 0)
{
int str_len;
@@ -747,22 +641,6 @@ rtrim(PG_FUNCTION_ARGS)
m -= str_len;
}
pfree(mp);
-#else
- while (m > 0)
- {
- ptr2 = VARDATA(set);
- while (ptr2 <= end2)
- {
- if (*end == *ptr2)
- break;
- ++ptr2;
- }
- if (ptr2 > end2)
- break;
- end--;
- m--;
- }
-#endif
ret = (text *) palloc(VARHDRSZ + m);
VARATT_SIZEP(ret) = VARHDRSZ + m;
memcpy(VARDATA(ret), ptr, m);
@@ -805,13 +683,11 @@ translate(PG_FUNCTION_ARGS)
retlen,
i;
-#ifdef MULTIBYTE
int str_len;
int estimate_len;
int len;
int source_len;
int from_index;
-#endif
if ((m = VARSIZE(string) - VARHDRSZ) <= 0)
PG_RETURN_TEXT_P(string);
@@ -821,20 +697,15 @@ translate(PG_FUNCTION_ARGS)
tolen = VARSIZE(to) - VARHDRSZ;
to_ptr = VARDATA(to);
-#ifdef MULTIBYTE
str_len = VARSIZE(string);
estimate_len = (tolen * 1.0 / fromlen + 0.5) * str_len;
estimate_len = estimate_len > str_len ? estimate_len : str_len;
result = (text *) palloc(estimate_len);
-#else
- result = (text *) palloc(VARSIZE(string));
-#endif
source = VARDATA(string);
target = VARDATA(result);
retlen = 0;
-#ifdef MULTIBYTE
while (m > 0)
{
source_len = pg_mblen(source);
@@ -880,37 +751,6 @@ translate(PG_FUNCTION_ARGS)
source += source_len;
m -= source_len;
}
-#else
- while (m-- > 0)
- {
- char rep = *source++;
-
- for (i = 0; i < fromlen; i++)
- {
- if (from_ptr[i] == rep)
- break;
- }
- if (i < fromlen)
- {
- if (i < tolen)
- {
- /* substitute */
- *target++ = to_ptr[i];
- retlen++;
- }
- else
- {
- /* discard */
- }
- }
- else
- {
- /* no match, so copy */
- *target++ = rep;
- retlen++;
- }
- }
-#endif
VARATT_SIZEP(result) = retlen + VARHDRSZ;
diff --git a/src/backend/utils/adt/quote.c b/src/backend/utils/adt/quote.c
index 537e97a50ee..97946866d01 100644
--- a/src/backend/utils/adt/quote.c
+++ b/src/backend/utils/adt/quote.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/quote.c,v 1.7 2002/04/04 04:25:49 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/quote.c,v 1.8 2002/08/29 07:22:27 ishii Exp $
*
*-------------------------------------------------------------------------
*/
@@ -70,102 +70,6 @@ quote_literal(PG_FUNCTION_ARGS)
*
*/
-
-#ifndef MULTIBYTE
-
-/* Check if a given identifier needs quoting */
-static bool
-quote_ident_required(text *iptr)
-{
- char *cp;
- char *ep;
-
- cp = VARDATA(iptr);
- ep = VARDATA(iptr) + VARSIZE(iptr) - VARHDRSZ;
-
- if (cp >= ep)
- return true;
-
- if (!(*cp == '_' || (*cp >= 'a' && *cp <= 'z')))
- return true;
-
- while ((++cp) < ep)
- {
- if (*cp >= 'a' && *cp <= 'z')
- continue;
- if (*cp >= '0' && *cp <= '9')
- continue;
- if (*cp == '_')
- continue;
-
- return true;
- }
-
- return false;
-}
-
-/* Return a properly quoted identifier */
-static text *
-do_quote_ident(text *iptr)
-{
- text *result;
- char *cp1;
- char *cp2;
- int len;
-
- len = VARSIZE(iptr) - VARHDRSZ;
- result = (text *) palloc(len * 2 + VARHDRSZ + 2);
-
- cp1 = VARDATA(iptr);
- cp2 = VARDATA(result);
-
- *cp2++ = '"';
- while (len-- > 0)
- {
- if (*cp1 == '"')
- *cp2++ = '"';
- *cp2++ = *cp1++;
- }
- *cp2++ = '"';
-
- VARATT_SIZEP(result) = cp2 - ((char *) result);
-
- return result;
-}
-
-/* Return a properly quoted literal value */
-static text *
-do_quote_literal(text *lptr)
-{
- text *result;
- char *cp1;
- char *cp2;
- int len;
-
- len = VARSIZE(lptr) - VARHDRSZ;
- result = (text *) palloc(len * 2 + VARHDRSZ + 2);
-
- cp1 = VARDATA(lptr);
- cp2 = VARDATA(result);
-
- *cp2++ = '\'';
- while (len-- > 0)
- {
- if (*cp1 == '\'')
- *cp2++ = '\'';
- if (*cp1 == '\\')
- *cp2++ = '\\';
- *cp2++ = *cp1++;
- }
- *cp2++ = '\'';
-
- VARATT_SIZEP(result) = cp2 - ((char *) result);
-
- return result;
-}
-
-#else
-
/* Check if a given identifier needs quoting (MULTIBYTE version) */
static bool
quote_ident_required(text *iptr)
@@ -285,5 +189,3 @@ do_quote_literal(text *lptr)
return result;
}
-
-#endif
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
index 986c7659f2c..4835b0c3a5e 100644
--- a/src/backend/utils/adt/selfuncs.c
+++ b/src/backend/utils/adt/selfuncs.c
@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.113 2002/08/22 00:01:44 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.114 2002/08/29 07:22:27 ishii Exp $
*
*-------------------------------------------------------------------------
*/
@@ -3250,12 +3250,8 @@ make_greater_string(const char *str, Oid datatype)
* Truncate off the last character, which might be more than 1
* byte in MULTIBYTE case.
*/
-#ifdef MULTIBYTE
len = pg_mbcliplen((const unsigned char *) workstr, len, len - 1);
workstr[len] = '\0';
-#else
- *lastchar = '\0';
-#endif
}
/* Failed... */
diff --git a/src/backend/utils/adt/varchar.c b/src/backend/utils/adt/varchar.c
index cdf5c301d2e..e1181dd375f 100644
--- a/src/backend/utils/adt/varchar.c
+++ b/src/backend/utils/adt/varchar.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.91 2002/08/26 17:53:59 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.92 2002/08/29 07:22:27 ishii Exp $
*
*-------------------------------------------------------------------------
*/
@@ -21,9 +21,7 @@
#include "utils/builtins.h"
#include "utils/fmgroids.h"
-#ifdef MULTIBYTE
#include "mb/pg_wchar.h"
-#endif
/*
@@ -76,37 +74,26 @@ bpcharin(PG_FUNCTION_ARGS)
maxlen;
int i;
-#ifdef MULTIBYTE
int charlen; /* number of charcters in the input string */
char *ermsg;
-#endif
len = strlen(s);
-#ifdef MULTIBYTE
+
if ((ermsg = pg_verifymbstr(s, len)))
elog(ERROR, "%s", ermsg);
charlen = pg_mbstrlen(s);
-#endif
+
/* If typmod is -1 (or invalid), use the actual string length */
if (atttypmod < (int32) VARHDRSZ)
-#ifdef MULTIBYTE
maxlen = charlen;
-#else
- maxlen = len;
-#endif
else
maxlen = atttypmod - VARHDRSZ;
-#ifdef MULTIBYTE
if (charlen > maxlen)
-#else
- if (len > maxlen)
-#endif
{
/* Verify that extra characters are spaces, and clip them off */
-#ifdef MULTIBYTE
size_t mbmaxlen = pg_mbcharcliplen(s, len, maxlen);
/*
@@ -125,15 +112,7 @@ bpcharin(PG_FUNCTION_ARGS)
* the number of CHARACTERS!
*/
maxlen = len;
-#else
- if (strspn(s + maxlen, " ") == len - maxlen)
- len = maxlen;
- else
- elog(ERROR, "value too long for type character(%d)",
- (int) maxlen);
-#endif
}
-#ifdef MULTIBYTE
else
{
/*
@@ -142,7 +121,6 @@ bpcharin(PG_FUNCTION_ARGS)
*/
maxlen = len + (maxlen - charlen);
}
-#endif
result = palloc(maxlen + VARHDRSZ);
VARATT_SIZEP(result) = maxlen + VARHDRSZ;
@@ -202,26 +180,19 @@ bpchar(PG_FUNCTION_ARGS)
char *s;
int i;
-#ifdef MULTIBYTE
int charlen; /* number of charcters in the input string
* + VARHDRSZ */
-#endif
-
len = VARSIZE(source);
-#ifdef MULTIBYTE
+
charlen = pg_mbstrlen_with_len(VARDATA(source), len - VARHDRSZ) + VARHDRSZ;
-#endif
+
/* No work if typmod is invalid or supplied data matches it already */
if (maxlen < (int32) VARHDRSZ || len == maxlen)
PG_RETURN_BPCHAR_P(source);
-#ifdef MULTIBYTE
+
if (charlen > maxlen)
-#else
- if (len > maxlen)
-#endif
{
/* Verify that extra characters are spaces, and clip them off */
-#ifdef MULTIBYTE
size_t maxmblen;
maxmblen = pg_mbcharcliplen(VARDATA(source), len - VARHDRSZ,
@@ -239,16 +210,7 @@ bpchar(PG_FUNCTION_ARGS)
* length+VARHDRSZ, not the number of CHARACTERS!
*/
maxlen = len;
-#else
- for (i = maxlen - VARHDRSZ; i < len - VARHDRSZ; i++)
- if (*(VARDATA(source) + i) != ' ')
- elog(ERROR, "value too long for type character(%d)",
- maxlen - VARHDRSZ);
-
- len = maxlen;
-#endif
}
-#ifdef MULTIBYTE
else
{
/*
@@ -257,7 +219,6 @@ bpchar(PG_FUNCTION_ARGS)
*/
maxlen = len + (maxlen - charlen);
}
-#endif
s = VARDATA(source);
@@ -408,29 +369,22 @@ varcharin(PG_FUNCTION_ARGS)
size_t len,
maxlen;
-#ifdef MULTIBYTE
char *ermsg;
-#endif
len = strlen(s);
-#ifdef MULTIBYTE
+
if ((ermsg = pg_verifymbstr(s, len)))
elog(ERROR, "%s", ermsg);
-#endif
+
maxlen = atttypmod - VARHDRSZ;
if (atttypmod >= (int32) VARHDRSZ && len > maxlen)
{
/* Verify that extra characters are spaces, and clip them off */
-#ifdef MULTIBYTE
size_t mbmaxlen = pg_mbcharcliplen(s, len, maxlen);
if (strspn(s + mbmaxlen, " ") == len - mbmaxlen)
len = mbmaxlen;
-#else
- if (strspn(s + maxlen, " ") == len - maxlen)
- len = maxlen;
-#endif
else
elog(ERROR, "value too long for type character varying(%d)",
(int) maxlen);
@@ -493,7 +447,6 @@ varchar(PG_FUNCTION_ARGS)
/* only reach here if string is too long... */
-#ifdef MULTIBYTE
{
size_t maxmblen;
@@ -508,15 +461,6 @@ varchar(PG_FUNCTION_ARGS)
len = maxmblen;
}
-#else
- for (i = maxlen - VARHDRSZ; i < len - VARHDRSZ; i++)
- if (*(VARDATA(source) + i) != ' ')
- elog(ERROR, "value too long for type character varying(%d)",
- maxlen - VARHDRSZ);
-
- /* clip extra spaces */
- len = maxlen;
-#endif
result = palloc(len);
VARATT_SIZEP(result) = len;
@@ -584,7 +528,6 @@ bpcharlen(PG_FUNCTION_ARGS)
{
BpChar *arg = PG_GETARG_BPCHAR_P(0);
-#ifdef MULTIBYTE
/* optimization for single byte encoding */
if (pg_database_encoding_max_length() <= 1)
PG_RETURN_INT32(VARSIZE(arg) - VARHDRSZ);
@@ -592,9 +535,6 @@ bpcharlen(PG_FUNCTION_ARGS)
PG_RETURN_INT32(
pg_mbstrlen_with_len(VARDATA(arg), VARSIZE(arg) - VARHDRSZ)
);
-#else
- PG_RETURN_INT32(VARSIZE(arg) - VARHDRSZ);
-#endif
}
Datum
@@ -796,7 +736,6 @@ varcharlen(PG_FUNCTION_ARGS)
{
VarChar *arg = PG_GETARG_VARCHAR_P(0);
-#ifdef MULTIBYTE
/* optimization for single byte encoding */
if (pg_database_encoding_max_length() <= 1)
PG_RETURN_INT32(VARSIZE(arg) - VARHDRSZ);
@@ -804,9 +743,6 @@ varcharlen(PG_FUNCTION_ARGS)
PG_RETURN_INT32(
pg_mbstrlen_with_len(VARDATA(arg), VARSIZE(arg) - VARHDRSZ)
);
-#else
- PG_RETURN_INT32(VARSIZE(arg) - VARHDRSZ);
-#endif
}
Datum
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 52598aba9e8..6e00a3e2835 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.89 2002/08/28 20:46:24 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.90 2002/08/29 07:22:27 ishii Exp $
*
*-------------------------------------------------------------------------
*/
@@ -217,16 +217,12 @@ textin(PG_FUNCTION_ARGS)
text *result;
int len;
-#ifdef MULTIBYTE
char *ermsg;
-#endif
len = strlen(inputText) + VARHDRSZ;
-#ifdef MULTIBYTE
if ((ermsg = pg_verifymbstr(inputText, len - VARHDRSZ)))
elog(ERROR, "%s", ermsg);
-#endif
result = (text *) palloc(len);
VARATT_SIZEP(result) = len;
@@ -1476,12 +1472,8 @@ SplitIdentifierString(char *rawstring, char separator,
curlen = strlen(curname);
if (curlen >= NAMEDATALEN)
{
-#ifdef MULTIBYTE
curlen = pg_mbcliplen(curname, curlen, NAMEDATALEN - 1);
curname[curlen] = '\0';
-#else
- curname[NAMEDATALEN - 1] = '\0';
-#endif
}
/*
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index d26e55368db..fdd4388e5ca 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.99 2002/06/20 20:29:39 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.100 2002/08/29 07:22:28 ishii Exp $
*
*-------------------------------------------------------------------------
*/
@@ -35,9 +35,7 @@
#include "tcop/tcopprot.h"
#include "utils/memutils.h"
-#ifdef MULTIBYTE
#include "mb/pg_wchar.h"
-#endif
int server_min_messages;
char *server_min_messages_str = NULL;
@@ -694,14 +692,14 @@ write_syslog(int level, const char *line)
*strchr(buf, '\n') = '\0';
l = strlen(buf);
-#ifdef MULTIBYTE
+
/* trim to multibyte letter boundary */
buflen = pg_mbcliplen(buf, l, l);
if (buflen <= 0)
return;
buf[buflen] = '\0';
l = strlen(buf);
-#endif
+
/* already word boundary? */
if (isspace((unsigned char) line[l]) || line[l] == '\0')
buflen = l;
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index 433b9a5ed05..f36c1d981fa 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.109 2002/07/20 05:16:59 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.110 2002/08/29 07:22:28 ishii Exp $
*
*
*-------------------------------------------------------------------------
@@ -130,17 +130,10 @@ ReverifyMyDatabase(const char *name)
* encoding info out of the pg_database tuple --- or complain, if we
* can't support it.
*/
-#ifdef MULTIBYTE
SetDatabaseEncoding(dbform->encoding);
/* If we have no other source of client_encoding, use server encoding */
SetConfigOption("client_encoding", GetDatabaseEncodingName(),
PGC_BACKEND, PGC_S_DEFAULT);
-#else
- if (dbform->encoding != PG_SQL_ASCII)
- elog(FATAL, "database was initialized with MULTIBYTE encoding %d,\n\tbut the backend was compiled without multibyte support.\n\tlooks like you need to initdb or recompile.",
- dbform->encoding);
-#endif
-
/*
* Set up database-specific configuration variables.
*/
diff --git a/src/backend/utils/mb/mbutils.c b/src/backend/utils/mb/mbutils.c
index 4b77dcfa6a1..ef96f7d04b4 100644
--- a/src/backend/utils/mb/mbutils.c
+++ b/src/backend/utils/mb/mbutils.c
@@ -3,7 +3,7 @@
* client encoding and server internal encoding.
* (currently mule internal code (mic) is used)
* Tatsuo Ishii
- * $Id: mbutils.c,v 1.32 2002/08/19 04:08:08 ishii Exp $
+ * $Id: mbutils.c,v 1.33 2002/08/29 07:22:28 ishii Exp $
*/
#include "postgres.h"
#include "access/xact.h"
@@ -34,6 +34,9 @@ static FmgrInfo *ToClientConvPorc = NULL;
static unsigned char *
perform_default_encoding_conversion(unsigned char *src, int len, bool is_client_to_server);
+static int
+cliplen(const unsigned char *str, int len, int limit);
+
/*
* Set the client encoding and save fmgrinfo for the converion
* function if necessary. if encoding conversion between client/server
@@ -371,6 +374,10 @@ pg_mbstrlen(const unsigned char *mbstr)
{
int len = 0;
+ /* optimization for single byte encoding */
+ if (pg_database_encoding_max_length() == 1)
+ return strlen((char *)mbstr);
+
while (*mbstr)
{
mbstr += pg_mblen(mbstr);
@@ -409,6 +416,10 @@ pg_mbcliplen(const unsigned char *mbstr, int len, int limit)
int clen = 0;
int l;
+ /* optimization for single byte encoding */
+ if (pg_database_encoding_max_length() == 1)
+ return cliplen(mbstr, len, limit);
+
while (len > 0 && *mbstr)
{
l = pg_mblen(mbstr);
@@ -424,7 +435,7 @@ pg_mbcliplen(const unsigned char *mbstr, int len, int limit)
}
/*
- * Similar to pg_mbcliplen but the limit parameter specifies the
+ * Similar to pg_mbcliplen except the limit parameter specifies the
* character length, not the byte length. */
int
pg_mbcharcliplen(const unsigned char *mbstr, int len, int limit)
@@ -433,6 +444,10 @@ pg_mbcharcliplen(const unsigned char *mbstr, int len, int limit)
int nch = 0;
int l;
+ /* optimization for single byte encoding */
+ if (pg_database_encoding_max_length() == 1)
+ return cliplen(mbstr, len, limit);
+
while (len > 0 && *mbstr)
{
l = pg_mblen(mbstr);
@@ -489,3 +504,17 @@ pg_client_encoding(PG_FUNCTION_ARGS)
Assert(ClientEncoding);
return DirectFunctionCall1(namein, CStringGetDatum(ClientEncoding->name));
}
+
+static int
+cliplen(const unsigned char *str, int len, int limit)
+{
+ int l = 0;
+ const unsigned char *s;
+
+ for (s = str; *s; s++, l++)
+ {
+ if (l >= len || l >= limit)
+ return l;
+ }
+ return (s - str);
+}
diff --git a/src/include/regex/regex.h b/src/include/regex/regex.h
index dd8e0da171b..cf20160b6d9 100644
--- a/src/include/regex/regex.h
+++ b/src/include/regex/regex.h
@@ -52,10 +52,7 @@ typedef struct
size_t re_nsub; /* number of parenthesized subexpressions */
const pg_wchar *re_endp; /* end pointer for REG_PEND */
struct re_guts *re_g; /* none of your business :-) */
-#ifdef MULTIBYTE
pg_wchar *patsave; /* me too :-) */
-#endif
-
} regex_t;
typedef struct
diff --git a/src/include/regex/regex2.h b/src/include/regex/regex2.h
index 98bf46a52e3..5ceed7fe9c0 100644
--- a/src/include/regex/regex2.h
+++ b/src/include/regex/regex2.h
@@ -113,18 +113,13 @@ typedef struct
{
uch *ptr; /* -> uch [csetsize] */
uch mask; /* bit within array */
-#ifdef MULTIBYTE
pg_wchar hash; /* hash code */
unsigned int lc; /* leading character (character-set) */
-#else
- uch hash; /* hash code */
-#endif
size_t smultis;
char *multis; /* -> char[smulti] ab\0cd\0ef\0\0 */
} cset;
/* note that CHadd and CHsub are unsafe, and CHIN doesn't yield 0/1 */
-#ifdef MULTIBYTE
#define CHlc(c) (((unsigned)(c)&0xff0000)>>16)
#define CHadd(cs, c) ((cs)->ptr[(unsigned)(c)&0xffff] |= (cs)->mask, (cs)->hash += (unsigned)(c)&0xffff,\
(cs)->lc = CHlc(c))
@@ -135,15 +130,6 @@ typedef struct
* fns */
#define MCsub(p, cs, cp) mcsub(p, cs, cp)
#define MCin(p, cs, cp) mcin(p, cs, cp)
-#else
-#define CHadd(cs, c) ((cs)->ptr[(uch)(c)] |= (cs)->mask, (cs)->hash += (c))
-#define CHsub(cs, c) ((cs)->ptr[(uch)(c)] &= ~(cs)->mask, (cs)->hash -= (c))
-#define CHIN(cs, c) ((cs)->ptr[(uch)(c)] & (cs)->mask)
-#define MCadd(p, cs, cp) mcadd(p, cs, cp) /* regcomp() internal
- * fns */
-#define MCsub(p, cs, cp) mcsub(p, cs, cp)
-#define MCin(p, cs, cp) mcin(p, cs, cp)
-#endif
/* stuff for character categories */
typedef unsigned char cat_t;
@@ -182,16 +168,7 @@ struct re_guts
};
/* misc utilities */
-#ifdef MULTIBYTE
#define OUT (16777216+1) /* 16777216 == 2^24 == 3 bytes */
-#else
-#define OUT (CHAR_MAX+1) /* a non-character value */
-#endif
-#ifdef MULTIBYTE
#define ISWORD(c) (((c) >= 0 && (c) <= UCHAR_MAX) && \
(isalnum((unsigned char) (c)) || (c) == '_'))
-#else
-#define ISWORD(c) (isalnum((unsigned char) (c)) || (c) == '_')
-
-#endif
diff --git a/src/include/regex/utils.h b/src/include/regex/utils.h
index 282bb791ad6..5831122f7c9 100644
--- a/src/include/regex/utils.h
+++ b/src/include/regex/utils.h
@@ -46,11 +46,7 @@
#define DUPMAX 100000000 /* xxx is this right? */
#define INFINITY (DUPMAX + 1)
-#ifdef MULTIBYTE
#define NC (SHRT_MAX - SHRT_MIN + 1)
-#else
-#define NC (CHAR_MAX - CHAR_MIN + 1)
-#endif
typedef unsigned char uch;
diff --git a/src/include/utils/ascii.h b/src/include/utils/ascii.h
index 068cf61a6c9..a2a983f2428 100644
--- a/src/include/utils/ascii.h
+++ b/src/include/utils/ascii.h
@@ -2,7 +2,7 @@
/* -----------------------------------------------------------------------
* ascii.h
*
- * $Id: ascii.h,v 1.8 2001/11/05 17:46:36 momjian Exp $
+ * $Id: ascii.h,v 1.9 2002/08/29 07:22:29 ishii Exp $
*
* Portions Copyright (c) 1999-2000, PostgreSQL Global Development Group
*
@@ -18,10 +18,7 @@ extern Datum to_ascii_encname(PG_FUNCTION_ARGS);
extern Datum to_ascii_enc(PG_FUNCTION_ARGS);
extern Datum to_ascii_default(PG_FUNCTION_ARGS);
-#ifdef MULTIBYTE
-
extern char *pg_to_ascii(unsigned char *src, unsigned char *src_end,
unsigned char *desc, int enc);
-#endif /* MULTIBYTE */
#endif /* _ASCII_H_ */
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 6f33ee4e42c..33467c2ff03 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: builtins.h,v 1.196 2002/08/29 00:17:06 tgl Exp $
+ * $Id: builtins.h,v 1.197 2002/08/29 07:22:29 ishii Exp $
*
*-------------------------------------------------------------------------
*/
@@ -661,9 +661,7 @@ extern Datum RI_FKey_setnull_upd(PG_FUNCTION_ARGS);
extern Datum RI_FKey_setdefault_del(PG_FUNCTION_ARGS);
extern Datum RI_FKey_setdefault_upd(PG_FUNCTION_ARGS);
-/* even if MULTIBYTE is not enabled, these functions are necessary
- * since pg_proc.h has references to them.
- */
+/* multibyte support functions */
extern Datum getdatabaseencoding(PG_FUNCTION_ARGS);
extern Datum database_character_set(PG_FUNCTION_ARGS);
extern Datum pg_client_encoding(PG_FUNCTION_ARGS);
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index 6ccc702c994..3272de9be5f 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.197 2002/08/27 16:21:51 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.198 2002/08/29 07:22:29 ishii Exp $
*
*-------------------------------------------------------------------------
*/
@@ -45,9 +45,7 @@
#include <crypt.h>
#endif
-#ifdef MULTIBYTE
#include "mb/pg_wchar.h"
-#endif
#ifdef WIN32
static int
@@ -157,11 +155,9 @@ static const struct EnvironmentOptions
{
"PGTZ", "timezone"
},
-#ifdef MULTIBYTE
{
"PGCLIENTENCODING", "client_encoding"
},
-#endif
/* internal performance-related settings */
{
"PGGEQO", "geqo"
@@ -1584,12 +1580,7 @@ PQsetenvStart(PGconn *conn)
conn->setenv_state != SETENV_STATE_IDLE)
return false;
-#ifdef MULTIBYTE
conn->setenv_state = SETENV_STATE_ENCODINGS_SEND;
-#else
- conn->setenv_state = SETENV_STATE_OPTION_SEND;
-#endif
-
conn->next_eo = EnvironmentOptions;
return true;
@@ -1606,9 +1597,7 @@ PQsetenvPoll(PGconn *conn)
{
PGresult *res;
-#ifdef MULTIBYTE
static const char envname[] = "PGCLIENTENCODING";
-#endif
if (conn == NULL || conn->status == CONNECTION_BAD)
return PGRES_POLLING_FAILED;
@@ -1617,9 +1606,7 @@ PQsetenvPoll(PGconn *conn)
switch (conn->setenv_state)
{
/* These are reading states */
-#ifdef MULTIBYTE
case SETENV_STATE_ENCODINGS_WAIT:
-#endif
case SETENV_STATE_OPTION_WAIT:
{
/* Load waiting data */
@@ -1634,9 +1621,7 @@ PQsetenvPoll(PGconn *conn)
}
/* These are writing states, so we just proceed. */
-#ifdef MULTIBYTE
case SETENV_STATE_ENCODINGS_SEND:
-#endif
case SETENV_STATE_OPTION_SEND:
break;
@@ -1660,7 +1645,6 @@ keep_going: /* We will come back to here until there
switch (conn->setenv_state)
{
-#ifdef MULTIBYTE
case SETENV_STATE_ENCODINGS_SEND:
{
const char *env;
@@ -1734,7 +1718,6 @@ keep_going: /* We will come back to here until there
conn->setenv_state = SETENV_STATE_OPTION_SEND;
goto keep_going;
}
-#endif
case SETENV_STATE_OPTION_SEND:
{
@@ -2788,9 +2771,6 @@ PQclientEncoding(const PGconn *conn)
int
PQsetClientEncoding(PGconn *conn, const char *encoding)
{
-
-#ifdef MULTIBYTE
-
char qbuf[128];
static char query[] = "set client_encoding to '%s'";
PGresult *res;
@@ -2822,9 +2802,6 @@ PQsetClientEncoding(PGconn *conn, const char *encoding)
}
PQclear(res);
return (status);
-#else
- return -1; /* Multibyte support isn't compiled in */
-#endif
}
void
diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c
index be91d796c08..8e40a531c28 100644
--- a/src/interfaces/libpq/fe-misc.c
+++ b/src/interfaces/libpq/fe-misc.c
@@ -25,7 +25,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.77 2002/08/17 12:33:18 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.78 2002/08/29 07:22:30 ishii Exp $
*
*-------------------------------------------------------------------------
*/
@@ -50,10 +50,7 @@
#include "libpq-fe.h"
#include "libpq-int.h"
#include "pqsignal.h"
-
-#ifdef MULTIBYTE
#include "mb/pg_wchar.h"
-#endif
#define DONOTICE(conn,message) \
((*(conn)->noticeHook) ((conn)->noticeArg, (message)))
@@ -847,7 +844,6 @@ retry5:
* to be in fe-print.c but that file is doomed.
*/
-#ifdef MULTIBYTE
/*
* returns the byte length of the word beginning s, using the
* specified encoding.
@@ -873,23 +869,6 @@ PQenv2encoding(void)
return (encoding);
}
-#else
-
-/* Provide a default definition in case someone calls it anyway */
-int
-PQmblen(const unsigned char *s, int encoding)
-{
- (void) s;
- (void) encoding;
- return 1;
-}
-int
-PQenv2encoding(void)
-{
- return 0;
-}
-#endif /* MULTIBYTE */
-
#ifdef ENABLE_NLS
char *
diff --git a/src/interfaces/libpq/fe-print.c b/src/interfaces/libpq/fe-print.c
index 33f370f46f1..baa9700934c 100644
--- a/src/interfaces/libpq/fe-print.c
+++ b/src/interfaces/libpq/fe-print.c
@@ -10,7 +10,7 @@
* didn't really belong there.
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.45 2002/06/20 20:29:54 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.46 2002/08/29 07:22:30 ishii Exp $
*
*-------------------------------------------------------------------------
*/
@@ -352,11 +352,7 @@ do_field(const PQprintOpt *po, const PGresult *res,
/* Detect whether field contains non-numeric data */
char ch = '0';
-#ifdef MULTIBYTE
for (p = pval; *p; p += PQmblen(p, res->client_encoding))
-#else
- for (p = pval; *p; p++)
-#endif
{
ch = *p;
if (!((ch >= '0' && ch <= '9') ||
diff --git a/src/pl/plpgsql/src/pl_funcs.c b/src/pl/plpgsql/src/pl_funcs.c
index 6ca9f583357..33103a9eb4a 100644
--- a/src/pl/plpgsql/src/pl_funcs.c
+++ b/src/pl/plpgsql/src/pl_funcs.c
@@ -3,7 +3,7 @@
* procedural language
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.19 2002/08/08 01:36:05 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.20 2002/08/29 07:22:30 ishii Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
@@ -46,9 +46,7 @@
#include "plpgsql.h"
#include "pl.tab.h"
-#ifdef MULTIBYTE
#include "mb/pg_wchar.h"
-#endif
/* ----------
@@ -404,11 +402,7 @@ plpgsql_convert_ident(const char *s, char **output, int numidents)
{
int len;
-#ifdef MULTIBYTE
len = pg_mbcliplen(curident, i, NAMEDATALEN-1);
-#else
- len = NAMEDATALEN-1;
-#endif
curident[len] = '\0';
}