Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5388216

Browse files
committed
Revert ECPG's use of pnstrdup()
Commit0b9466f added a dependency on fe_memutils' pnstrdup() insideinformix.c. This adds an exit() path in a library, which we don'twant. (Unlike libpq, the ecpg libraries don't have an automated checkfor that, but it makes sense to keep them to a similar standard.) Theecpg code can already handle failure results from the *strdup() callby itself.Author: Jacob Champion <jacob.champion@enterprisedb.com>Discussion:https://www.postgresql.org/message-id/CAOYmi+=pg=W5L1h=3MEP_EB24jaBu2FyATrLXqQHGe7cpuvwyg@mail.gmail.com
1 parent40064a8 commit5388216

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

‎src/interfaces/ecpg/compatlib/informix.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,25 @@ deccopy(decimal *src, decimal *target)
175175
memcpy(target,src,sizeof(decimal));
176176
}
177177

178+
staticchar*
179+
ecpg_strndup(constchar*str,size_tlen)
180+
{
181+
size_treal_len=strlen(str);
182+
intuse_len= (int) ((real_len>len) ?len :real_len);
183+
184+
char*new=malloc(use_len+1);
185+
186+
if (new)
187+
{
188+
memcpy(new,str,use_len);
189+
new[use_len]='\0';
190+
}
191+
else
192+
errno=ENOMEM;
193+
194+
returnnew;
195+
}
196+
178197
int
179198
deccvasc(constchar*cp,intlen,decimal*np)
180199
{
@@ -186,8 +205,8 @@ deccvasc(const char *cp, int len, decimal *np)
186205
if (risnull(CSTRINGTYPE,cp))
187206
return0;
188207

189-
str=pnstrdup(cp,len);/* decimal_in always converts the complete
190-
* string */
208+
str=ecpg_strndup(cp,len);/* decimal_in always converts the complete
209+
* string */
191210
if (!str)
192211
ret=ECPG_INFORMIX_NUM_UNDERFLOW;
193212
else

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp