Skip to Content.
Sympa Menu

freetds - Re: [freetds] Strange assert

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Rusty Wright <rusty AT socrates.Berkeley.EDU>
  • To: freetds AT lists.ibiblio.org
  • Subject: Re: [freetds] Strange assert
  • Date: Mon, 17 Mar 2003 11:21:15 -0800 (PST)

> What do you say?
>
> --jkl

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.




Archive powered by MHonArc 2.6.24.

Top of Page