freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: Brian Bruns <camber AT ais.org>
- To: TDS Development Group <freetds AT franklin.metalab.unc.edu>
- Subject: Re: Non portable code
- Date: Wed, 2 Oct 2002 09:26:20 -0400 (EDT)
Hopefully the non-portable code is limited to certain freetds specific
functions. That is, instead of calling non-portable constructs directly we
generally make a wrapper function that calls them for us, that way porting
is limited to ifdef's in the wrapper functions and keeps the mainline code
clean looking.
We should perhaps combined vstrbuild.c and threadsafe.c into a port.c or
something similar to make this policy explicit?
As far as diffs go, please post them to the patches section on the
sourceforge site, unified diff format is preferred.
Cheers,
Brian
On Wed, 2 Oct 2002, Jonas Benjaminsson wrote:
> Hi all
>
> I'm porting FreeTDS to Windows and it's going well.
>
> (Brian or James: How should I commit the changes
> I make, by sending you the diffs or by accessing
> the CVS directly?)
>
> But...
>
> When I find code like the one below I shiver.
>
> Ok, it's an easy aproach but will never compile
> on a non Unix system. And what about the speed?
>
> Well, just wanted to share my thoughts.
>
>
> /Jonas Benjaminsson
>
>
>
>
> The code was found in asprintf.c
>
> FILE *fp;
> int len;
> char *buf;
>
> *ret = NULL;
> if ((fp = fopen("/dev/null", "w")) == NULL)
> return -1;
> len = vfprintf(fp, fmt, ap);
> if (fclose(fp) != 0)
> return -1;
> if (len < 0)
> return len;
> if ((buf = malloc(len + 1)) == NULL)
> return -1;
> vsprintf(buf, fmt, ap);
> *ret = buf;
> return len;
>
>
>
>
>
>
> ---
> You are currently subscribed to freetds as: [camber AT ais.org]
> To unsubscribe, forward this message to $subst('Email.Unsub')
>
-
Non portable code,
Jonas Benjaminsson, 10/02/2002
- <Possible follow-up(s)>
- RE: Non portable code, ZIGLIO Frediano, 10/02/2002
- RE: Non portable code, Jonas Benjaminsson, 10/02/2002
- RE: Non portable code, ZIGLIO Frediano, 10/02/2002
- Re: Non portable code, Brian Bruns, 10/02/2002
- RE: Non portable code, Brian Bruns, 10/02/2002
- Re: Non portable code, Castellano, Nicholas, 10/02/2002
- RE: Non portable code, Lowden, James K, 10/02/2002
- RE: Non portable code, Jonas Benjaminsson, 10/02/2002
- RE: Non portable code, Castellano, Nicholas, 10/02/2002
- RE: Non portable code, Lowden, James K, 10/02/2002
- RE: Non portable code, Bob Kline, 10/02/2002
- RE: Non portable code, Lowden, James K, 10/02/2002
Archive powered by MHonArc 2.6.24.