[freetds] some small patches...

Lowden, James K LowdenJK at bernstein.com
Tue Apr 15 10:40:46 EDT 2003

> From: Thompson, Bill D (London) [mailto:ThompBil at exchange.uk.ml.com]
> Sent: April 15, 2003 8:38 AM
> As I am about to go into production with freetds in the next 
> few weeks, I
> don't want to take the latest snapshot with all the charset 
> stuff

Good news, bad news, eh?  

I'm applying these, but I have a couple of questions.  

> +    case SYBDATETIME:
> +        memset(varaddr, '\0', 8);
> +        break;


> void
> dbexit()

> void tds_free_context(TDSCONTEXT *context)
> {
>     if (context && context->locale) {

tds_free_locale() returns immediately if its argument is NULL.  No need to
check it here.  IMO the rule should be that the tds_free* functions can be
passed null pointers harmlessly.  

>         tds_free_locale(context->locale);
>         context->locale = NULL;
>     }
>     if (context)
>         TDS_ZERO_FREE(context);
> }

Does "free(NULL)" cause a problem with your libraries?  It's not supposed
to; you should be able to free a null pointer without penalty.  If that *is*
a problem, we should change TDS_ZERO_FREE() to avoid it, add a note to our
CodingStyle or something, to let people (like me) know they can't rely on

This could be simplified to:

tds_free_context(TDSCONTEXT *context)

Does that work for you?   

> void tds_free_locale(TDSLOCALE *locale)
Already dealt with, per your prior message.  



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.

More information about the FreeTDS mailing list