Skip to Content.
Sympa Menu

freetds - RE: [freetds] [PATCH] make replacements more configurable

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Craig A. Berry" <craigberry AT mac.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: RE: [freetds] [PATCH] make replacements more configurable
  • Date: Wed, 29 Jan 2003 18:39:29 -0600

At 01:29 PM 1/28/2003 -0500, Lowden, James K wrote:

>Indeed, the TDS protocol does put binary floating point data on the wire.
>For TDS 5.0, the format is established at login time (see Sybase's "TDS 5.0
>Functional Specification", page 175). The 8-byte format is the IEEE 754
>float type, unless it's VAX 'D' or 'ND5000'. The 4-byte form is labelled
>just "IEEE floating point numbers", unless it's "VAX 'F' or 'ND5000'" form.

Looks like we'll have to punt on VAX for now. One would have to implement
conversions from IEEE and/or make FreeTDS request VAX floating point (thus
depending on the server to do the conversions, which may or may not be
available in recent versions of Sybase even, much less Microsoft).

>As a matter of architecture, this is really a link-time issue:

[discussion of link-time approaches snipped]

If you assume that you never relink without reconfiguring and rebuilding,
then it is purely link-time. If you don't assume that then it also involves
other stages of the build process. Even aside from that, though, I haven't
come up with a way of doing it at link time.

>The only solution I have atm is not much different from yours: rather than
>rename the functions, wrap their entirety in #if HAVE_AUTOCONF ||
>!HAVE_STRTOK or whatever. IOW, "produce this code if autoconf was used or
>there's no strtok()". Unixy systems will always produce the code (insofar
>as the preprocessor is concerned) but the makefile will never compile it.
>VMS systems will not define HAVE_AUTOCONF, leaving code production to the
>HAVE_STRTOK test.
>
>Your compiler would produce a module with no function; the linker would
>scoop it up but no name would be exported. That approach would be slightly
>better, I assert, because
>
>1. the names are preserved
>2. the preprocessor isn't interceding in linkage
>3. the resulting binary is smaller
>
>The unixy systems would be unaffected by this change, except for the
>complexity.


This approach was actually my first thought before I went the redefining
route. If it's cleaner to you, it works great for me and I include a patch
to do that below. I've omitted the HAVE_AUTOCONF bit since if I understand
correctly it will be redundant: systems that use autoconf to decide they
don't need the functions will never bother to compile them and thus won't
see that anyway; is that correct?


--- src/replacements/asprintf.c;-0 Sun Nov 17 05:28:12 2002
+++ src/replacements/asprintf.c Tue Jan 28 23:00:56 2003
@@ -15,6 +15,8 @@
static void *no_unused_var_warn[] = { software_version, no_unused_var_warn };


+#if !HAVE_ASPRINTF
+
int
asprintf(char **ret, const char *fmt, ...)
{
@@ -26,3 +28,5 @@
va_end(ap);
return len;
}
+
+#endif /* !HAVE_ASPRINTF */
--- src/replacements/atoll.c;-0 Sun Nov 17 05:28:12 2002
+++ src/replacements/atoll.c Tue Jan 28 23:05:10 2003
@@ -29,8 +29,12 @@
static char software_version[] = "$Id: atoll.c,v 1.7 2002/11/17 11:28:12
freddy77 Exp $";
static void *no_unused_var_warn[] = { software_version, no_unused_var_warn };

+#if !HAVE_ATOLL
+
tds_sysdep_int64_type
atoll(const char *nptr)
{
return atol(nptr);
}
+
+#endif /* !HAVE_ATOLL */
--- src/replacements/strtok_r.c;-0 Sun Nov 17 05:28:12 2002
+++ src/replacements/strtok_r.c Tue Jan 28 23:05:11 2003
@@ -19,6 +19,8 @@

#include "replacements.h"

+#if !HAVE_STRTOK_R
+
char *
strtok_r(char *str, const char *sep, char **lasts)
{
@@ -39,3 +41,5 @@
}
return str;
}
+
+#endif /* !HAVE_STRTOK_R */
--- src/replacements/vasprintf.c;-0 Mon Dec 9 10:40:59 2002
+++ src/replacements/vasprintf.c Tue Jan 28 23:03:18 2003
@@ -39,6 +39,9 @@
#endif

#define CHUNKSIZE 512
+
+#if !HAVE_VASPRINTF
+
int
vasprintf(char **ret, const char *fmt, va_list ap)
{
@@ -103,3 +106,6 @@
return len;
#endif /* HAVE_VSNPRINTF */
}
+
+#endif /* !HAVE_VASPRINTF */
+
[end of patch]






Archive powered by MHonArc 2.6.24.

Top of Page