Skip to Content.
Sympa Menu

freetds - RE: Non portable code

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: ZIGLIO Frediano <Frediano.Ziglio AT vodafoneomnitel.it>
  • To: "'TDS Development Group'" <freetds AT franklin.metalab.unc.edu>
  • Subject: RE: Non portable code
  • Date: Wed, 2 Oct 2002 15:11:21 +0200


>
> 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;
>
???

Ok, quite old, see current CVS if you have vsnprintf it use this last
function to implement it.
Also note that all this stuff is contained in a single file, so changes to
portability are limited...

How many windows programs are portable?

This project compile and run on Linux, FreeBSD, OpenBSD, Tru64, Solaris...

freddy77

=================================
"STRICTLY PERSONAL AND CONFIDENTIAL

This message may contain confidential and proprietary material for the sole
use of the intended recipient. Any review or distribution by others is
strictly prohibited. If you are not the intended recipient please contact
the sender and delete all copies.
The contents of this message that do not relate to the official business of
our company shall be understood as neither given nor endorsed by it."

=================================




Archive powered by MHonArc 2.6.24.

Top of Page