mirror of
https://github.com/gnustep/libs-sqlclient.git
synced 2025-02-15 16:11:42 +00:00
more efficient length calculation.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@20203 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
3afb33d92d
commit
c6fadc3e4a
1 changed files with 3 additions and 7 deletions
10
Postgres.m
10
Postgres.m
|
@ -546,7 +546,7 @@ static unsigned int trim(char *str)
|
|||
{
|
||||
unsigned int sLen = [blob length];
|
||||
unsigned char *src = (unsigned char*)[blob bytes];
|
||||
unsigned int length = 2;
|
||||
unsigned int length = sLen + 2;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < sLen; i++)
|
||||
|
@ -555,17 +555,13 @@ static unsigned int trim(char *str)
|
|||
|
||||
if (c < 32 || c > 126)
|
||||
{
|
||||
length += 5;
|
||||
length += 4;
|
||||
}
|
||||
else if (c == '\\')
|
||||
{
|
||||
length += 4;
|
||||
length += 3;
|
||||
}
|
||||
else if (c == '\'')
|
||||
{
|
||||
length += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
length += 1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue