1
0
mirror of https://github.com/postgres/postgres.git synced 2025-04-25 21:42:33 +03:00

pg_do_encoding_conversion cannot return NULL (at least not unless the input

is NULL), so remove some useless tests for the case.
This commit is contained in:
Tom Lane 2008-11-10 15:18:40 +00:00
parent d141e7493b
commit 2b74d45c1b
3 changed files with 3 additions and 15 deletions

View File

@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/snowball/dict_snowball.c,v 1.6 2008/01/01 19:45:51 momjian Exp $ * $PostgreSQL: pgsql/src/backend/snowball/dict_snowball.c,v 1.7 2008/11/10 15:18:40 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -262,9 +262,6 @@ dsnowball_lexize(PG_FUNCTION_ARGS)
strlen(txt), strlen(txt),
GetDatabaseEncoding(), GetDatabaseEncoding(),
PG_UTF8); PG_UTF8);
if (recoded == NULL)
elog(ERROR, "encoding conversion failed");
if (recoded != txt) if (recoded != txt)
{ {
pfree(txt); pfree(txt);
@ -294,9 +291,6 @@ dsnowball_lexize(PG_FUNCTION_ARGS)
strlen(txt), strlen(txt),
PG_UTF8, PG_UTF8,
GetDatabaseEncoding()); GetDatabaseEncoding());
if (recoded == NULL)
elog(ERROR, "encoding conversion failed");
if (recoded != txt) if (recoded != txt)
{ {
pfree(txt); pfree(txt);

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/tsearch/ts_locale.c,v 1.10 2008/06/18 20:55:42 tgl Exp $ * $PostgreSQL: pgsql/src/backend/tsearch/ts_locale.c,v 1.11 2008/11/10 15:18:40 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -204,10 +204,6 @@ t_readline(FILE *fp)
len, len,
PG_UTF8, PG_UTF8,
GetDatabaseEncoding()); GetDatabaseEncoding());
if (recoded == NULL) /* should not happen */
elog(ERROR, "encoding conversion failed");
if (recoded == buf) if (recoded == buf)
{ {
/* /*

View File

@ -4,7 +4,7 @@
* (currently mule internal code (mic) is used) * (currently mule internal code (mic) is used)
* Tatsuo Ishii * Tatsuo Ishii
* *
* $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.73 2008/06/18 23:08:47 tgl Exp $ * $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.74 2008/11/10 15:18:40 tgl Exp $
*/ */
#include "postgres.h" #include "postgres.h"
@ -381,8 +381,6 @@ pg_convert(PG_FUNCTION_ARGS)
*(str + len) = '\0'; *(str + len) = '\0';
result = pg_do_encoding_conversion(str, len, src_encoding, dest_encoding); result = pg_do_encoding_conversion(str, len, src_encoding, dest_encoding);
if (result == NULL)
elog(ERROR, "encoding conversion failed");
/* /*
* build bytea data type structure. * build bytea data type structure.