freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "Lowden, James K" <LowdenJK AT bernstein.com>
- To: "'FreeTDS Development Group'" <freetds AT lists.ibiblio.org>
- Subject: RE: [freetds] Strange assert
- Date: Mon, 17 Mar 2003 15:33:00 -0500
> From: Frediano Ziglio [mailto:freddyz77 AT tin.it]
> Sent: March 17, 2003 2:55 PM
> Il lun, 2003-03-17 alle 20:21, Rusty Wright ha scritto:
> >
> > I find the style of the "for" loop odd with the space test, and it's
> > wasteful of cpu cycles with it continually assigning to len. The
> > typical way I'd do this is
> >
> > for (i = len; i > 0; i--) {
> > if (dres.c[i] != ' ')
> > break;
> > }
> > len = i - 1;
> >
> > I don't think I've got the initial value of "i" correct; you had it
> > set to len-1, but you get the idea; move the test for the space into
> > the body of the loop and only assign to len after the loop finishes.
>
> In first iteration you test dres.c[len] != ' '... read buffer overflow
> and possible core. If len == 0 after assign len == -1...
>
> Perhaps better is
>
> for(i = len; --i >= 0; )
> if (dres.c[i] != ' ')
> break;
> len = i + 1;
Why not remove 'i':
for( ; len && dres.c[len-1] == ' '; len--);
Rusty, you mentioned CPU cycles. Does any of this affect the compiler's
assembly output? I haven't checked.
--jkl
The information contained in this transmission may contain privileged and
confidential information and is intended only for the use of the person(s)
named above. If you are not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, any
review, dissemination, distribution or duplication of this communication is
strictly prohibited. If you are not the intended recipient, please contact
the sender immediately by reply e-mail and destroy all copies of the
original message. Please note that we do not accept account orders and/or
instructions by e-mail, and therefore will not be responsible for carrying
out such orders and/or instructions.
-
[freetds] PHP MSSQL throught freetds failing inserts when there any word with a acent
, (continued)
-
[freetds] PHP MSSQL throught freetds failing inserts when there any word with a acent,
Aliet Santiesteban Sifontes, 03/15/2003
-
Re: [freetds] PHP MSSQL throught freetds failing inserts when there any word with a acent,
James K. Lowden, 03/15/2003
-
Re: [freetds] PHP MSSQL throught freetds failing inserts when there any word with a acent,
Aliet Santiesteban Sifontes, 03/15/2003
-
Re: [freetds] PHP MSSQL throught freetds failing inserts when there any word with a acent,
Aliet Santiesteban Sifontes, 03/15/2003
-
Re: [freetds] PHP MSSQL throught freetds failing inserts when there any word with a acent,
James K. Lowden, 03/15/2003
- Re: [freetds] PHP MSSQL throught freetds failing inserts when there any word with a acent, Frediano Ziglio, 03/16/2003
- Re: [freetds] PHP MSSQL throught freetds failing inserts when there any word with a acent, Aliet Santiesteban Sifontes, 03/17/2003
- Re: [freetds] PHP MSSQL throught freetds failing inserts when there any word with a acent, Aliet Santiesteban Sifontes, 03/21/2003
-
Re: [freetds] PHP MSSQL throught freetds failing inserts when there any word with a acent,
James K. Lowden, 03/15/2003
-
Re: [freetds] PHP MSSQL throught freetds failing inserts when there any word with a acent,
Aliet Santiesteban Sifontes, 03/15/2003
-
Re: [freetds] PHP MSSQL throught freetds failing inserts when there any word with a acent,
Aliet Santiesteban Sifontes, 03/15/2003
-
Re: [freetds] PHP MSSQL throught freetds failing inserts when there any word with a acent,
James K. Lowden, 03/15/2003
-
Re: [freetds] Strange assert,
Rusty Wright, 03/17/2003
- Re: [freetds] Strange assert, Frediano Ziglio, 03/17/2003
- RE: [freetds] Strange assert, Lowden, James K, 03/17/2003
- Re: [freetds] Strange assert, Rusty Wright, 03/18/2003
-
[freetds] PHP MSSQL throught freetds failing inserts when there any word with a acent,
Aliet Santiesteban Sifontes, 03/15/2003
Archive powered by MHonArc 2.6.24.