Skip to Content.
Sympa Menu

freetds - Re: Escape string function

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Winkless, Geoff" <geoff.winkless AT pera.com>
  • To: 'TDS Development Group' <freetds AT franklin.metalab.unc.edu>
  • Subject: Re: Escape string function
  • Date: Thu, 11 Jul 2002 16:41:23 +0100


Brian wrote:
> Not to mention lack of comments. ;-) I could have incremented
> the pointers
> directly to save a bit, but figured I'd go with the understandable
> version.
> There should be a terminator added before returning too, oops!
> > > outstr = malloc(strlen(outstr) + need + 1);
> > > > > for (i=0;i<strlen(instr);i++) {

Yeuck. Really you should do

for (i=0; instr[i]!=0; i++) {
....

in both loops, and

outstr = malloc(i + need);

instead of using strlen()

Geoff




Archive powered by MHonArc 2.6.24.

Top of Page