File tree 1 file changed +7
-8
lines changed
1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change 7
7
*
8
8
*
9
9
* IDENTIFICATION
10
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.40 1998/09/25 01:46:21 momjian Exp $
10
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.41 1998/09/25 15:51:02 momjian Exp $
11
11
*
12
12
*-------------------------------------------------------------------------
13
13
*/
@@ -147,14 +147,7 @@ bpchar(char *s, int32 len)
147
147
if ((len == -1 ) || (len == VARSIZE (s )))
148
148
return s ;
149
149
150
- #ifdef MULTIBYTE
151
- /* truncate multi-byte string in a way not to break
152
- multi-byte boundary */
153
- rlen = pg_mbcliplen (VARDATA (s ), len - VARHDRSZ , len - VARHDRSZ );
154
- len = rlen + VARHDRSZ ;
155
- #else
156
150
rlen = len - VARHDRSZ ;
157
- #endif
158
151
159
152
if (rlen > 4096 )
160
153
elog (ERROR , "bpchar: length of char() must be less than 4096" );
@@ -167,7 +160,13 @@ bpchar(char *s, int32 len)
167
160
result = (char * ) palloc (len );
168
161
VARSIZE (result ) = len ;
169
162
r = VARDATA (result );
163
+ #ifdef MULTIBYTE
164
+ /* truncate multi-byte string in a way not to break
165
+ multi-byte boundary */
166
+ slen = pg_mbcliplen (VARDATA (s ), rlen , rlen );
167
+ #else
170
168
slen = VARSIZE (s ) - VARHDRSZ ;
169
+ #endif
171
170
s = VARDATA (s );
172
171
173
172
#ifdef STRINGDEBUG
You can’t perform that action at this time.
0 commit comments