[freetds] Change in config.c

James K. Lowden jklowden at freetds.org
Thu Mar 2 21:43:19 EST 2006


ZIGLIO, Frediano, VF-IT wrote:
> I saw some changes in config.c. 

It wasn't me!  ;-)

Mainly I saw the warning compiling
> (http://freetds.sourceforge.net/out/test/make.html). Is it intentional
> to remove tds_config_env_tdshost call from tds_fix_connection?

Yes.  TDSHOST and DSQUERY are different from, say, TDSVER.  TDSVER
overrides freetds.conf.  DSQUERY shouldn't, but did.  

config.c was reading freetds.conf, and then applying all environmental
variables.  So:

	$ DSQUERY=jack tsql -S jill

connected to 'jack'.  TDSDUMPCONFIG tells all!  

login.c initializes the server name correctly; config.c doesn't have to
touch it.  

> I like the idea of a single #if !defined(WIN32

That was the main idea.  :-)

> - I don't think gcc (or other compiler) is so clever to detect possible
> formatting errors calling tdsdump_log

Do you mean that inline strings or preprocessor strings make the compiler
more likely to detect wrong arguments to tdsdump_log?  I hadn't thought
about that.  My gcc detects both of these (with -Wall):

	static const char fmt[] = "hello %s\n";
	printf(fmt, 1); 
	printf("hello %s\n", 1); 

but not if fmt is "char *fmt".  Touché! 

> - I don't like the extra space used to store pointers... someone could
> spot that 20/40 bytes (5 pointers in 32/64 bit) are very few but
> considering possible relocation these 5 pointers waste some hundred
> bytes.

I don't think it's important, but I wouldn't mind if you eliminate the
struct and use a series of char[] instead.  I like the struct for
collecting them together, but you make a good case.  If you don't fix it,
I will the next time I'm mucking with it.  

I very much dislike the preprocessor and much prefer C, so I very much
prefer:

	static const char interfaces_path[] = "/tmp";

and not

	#define INTERFACES_PATH "/tmp";

contrary to some of what's in tds.h.  

Regards, 

--jkl


More information about the FreeTDS mailing list