tdbc::mysql

Check-in [5dd83c8551]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Give the (U)INT2PTR / PTR2(U)INT macros .h file a more descriptive name and fully integrate them into the configure/build/dist. Tidy some CPP bits to make them like the other tdbc-* modules. Closes ticket [60999d7b92].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5dd83c8551ba7bb4fa7bb9257bc6a7b375b25229
User & Date: stu 2017-05-26 14:35:38
Original Comment: Give the (U)INT2PTR / PTR2(U)INT macros .h file a more descriptive name and fully integrate them into the configure/build/dist. Tidy some CPP bits to make them like the other tdbc-* modules.
References
2017-12-12
19:34 Closed ticket [60999d7b92]: pointer to integer assignment potentially unsafe plus 6 other changes artifact: 189826d604 user: kbk
Context
2017-05-26
18:30
rm -f not needed before ${INSTALL_*}. A ghost of past installing. check-in: 82f71b5e9f user: stu tags: trunk
14:35
Give the (U)INT2PTR / PTR2(U)INT macros .h file a more descriptive name and fully integrate them into the configure/build/dist. Tidy some CPP bits to make them like the other tdbc-* modules. Closes ticket [60999d7b92]. check-in: 5dd83c8551 user: stu tags: trunk
06:05
Use the right var to access the mysqlStubLibNames array. Closes [f3c6ec0369]. I think functional changes and whitespace cleanups should be done seperately. It's easy for something small to slip by in a big diff. check-in: 6313038acf user: stu tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Makefile.in.

326
327
328
329
330
331
332

333
334
335
336
337
338
339
	mkdir $(DIST_DIR)/generic
	cp -p $(srcdir)/generic/fakemysql.h \
		$(srcdir)/generic/mysqlStubDefs.txt \
		$(srcdir)/generic/mysqlStubInit.c \
		$(srcdir)/generic/mysqlStubs.h \
		$(srcdir)/generic/tdbcmysql.c \

		$(DIST_DIR)/generic/

	mkdir $(DIST_DIR)/library
	cp -p $(srcdir)/library/tdbcmysql.tcl $(DIST_DIR)/library/

	mkdir $(DIST_DIR)/tests
	cp -p $(srcdir)/tests/all.tcl $(srcdir)/tests/tdbcmysql.test \






>







326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
	mkdir $(DIST_DIR)/generic
	cp -p $(srcdir)/generic/fakemysql.h \
		$(srcdir)/generic/mysqlStubDefs.txt \
		$(srcdir)/generic/mysqlStubInit.c \
		$(srcdir)/generic/mysqlStubs.h \
		$(srcdir)/generic/tdbcmysql.c \
		$(srcdir)/generic/int2ptr_ptr2int.h \
		$(DIST_DIR)/generic/

	mkdir $(DIST_DIR)/library
	cp -p $(srcdir)/library/tdbcmysql.tcl $(DIST_DIR)/library/

	mkdir $(DIST_DIR)/tests
	cp -p $(srcdir)/tests/all.tcl $(srcdir)/tests/tdbcmysql.test \

Changes to configure.

9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
....
9221
9222
9223
9224
9225
9226
9227
9228





































9229
9230
9231
9232
9233
9234
9235
	    { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled $tcl_ok debugging" >&5
$as_echo "enabled $tcl_ok debugging" >&6; }
	fi
    fi


#--------------------------------------------------------------------
# INT2PTR  / PTR2INT  need to know about  intptr_t.
# UINT2PTR / PTR2UINT need to know about uintptr_t.
#--------------------------------------------------------------------


  ac_fn_c_check_type "$LINENO" "intptr_t" "ac_cv_type_intptr_t" "$ac_includes_default"
if test "x$ac_cv_type_intptr_t" = xyes; then :

$as_echo "#define HAVE_INTPTR_T 1" >>confdefs.h
................................................................................
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
       test -z "$ac_type" && break
     done
fi


#AC_TYPE_UINTPTR_T






































#--------------------------------------------------------------------
# Everyone should be linking against the Tcl stub library.  If you
# can't for some reason, remove this definition.  If you aren't using
# stubs, you also need to modify the SHLIB_LD_LIBS setting below to
# link against the non-stubbed Tcl library.  Add Tk too if necessary.
#--------------------------------------------------------------------






|
<







 







<
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







9181
9182
9183
9184
9185
9186
9187
9188

9189
9190
9191
9192
9193
9194
9195
....
9220
9221
9222
9223
9224
9225
9226

9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
	    { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled $tcl_ok debugging" >&5
$as_echo "enabled $tcl_ok debugging" >&6; }
	fi
    fi


#--------------------------------------------------------------------
# Integer pointer types used by the (U)INT2PTR / PTR2(U)INT macros.

#--------------------------------------------------------------------


  ac_fn_c_check_type "$LINENO" "intptr_t" "ac_cv_type_intptr_t" "$ac_includes_default"
if test "x$ac_cv_type_intptr_t" = xyes; then :

$as_echo "#define HAVE_INTPTR_T 1" >>confdefs.h
................................................................................
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
       test -z "$ac_type" && break
     done
fi




  ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "$ac_includes_default"
if test "x$ac_cv_type_uintptr_t" = xyes; then :

$as_echo "#define HAVE_UINTPTR_T 1" >>confdefs.h

else
  for ac_type in 'unsigned int' 'unsigned long int' \
	'unsigned long long int'; do
       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($ac_type))];
test_array [0] = 0;
return test_array [0];

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :

cat >>confdefs.h <<_ACEOF
#define uintptr_t $ac_type
_ACEOF

	  ac_type=
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
       test -z "$ac_type" && break
     done
fi



#--------------------------------------------------------------------
# Everyone should be linking against the Tcl stub library.  If you
# can't for some reason, remove this definition.  If you aren't using
# stubs, you also need to modify the SHLIB_LD_LIBS setting below to
# link against the non-stubbed Tcl library.  Add Tk too if necessary.
#--------------------------------------------------------------------

Changes to configure.ac.

168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#--------------------------------------------------------------------
# Set the default compiler switches based on the --enable-symbols option.
#--------------------------------------------------------------------

TEA_ENABLE_SYMBOLS

#--------------------------------------------------------------------
# INT2PTR  / PTR2INT  need to know about  intptr_t.
# UINT2PTR / PTR2UINT need to know about uintptr_t.
#--------------------------------------------------------------------

AC_TYPE_INTPTR_T
#AC_TYPE_UINTPTR_T

#--------------------------------------------------------------------
# Everyone should be linking against the Tcl stub library.  If you
# can't for some reason, remove this definition.  If you aren't using
# stubs, you also need to modify the SHLIB_LD_LIBS setting below to
# link against the non-stubbed Tcl library.  Add Tk too if necessary.
#--------------------------------------------------------------------






|
<



|







168
169
170
171
172
173
174
175

176
177
178
179
180
181
182
183
184
185
186
#--------------------------------------------------------------------
# Set the default compiler switches based on the --enable-symbols option.
#--------------------------------------------------------------------

TEA_ENABLE_SYMBOLS

#--------------------------------------------------------------------
# Integer pointer types used by the (U)INT2PTR / PTR2(U)INT macros.

#--------------------------------------------------------------------

AC_TYPE_INTPTR_T
AC_TYPE_UINTPTR_T

#--------------------------------------------------------------------
# Everyone should be linking against the Tcl stub library.  If you
# can't for some reason, remove this definition.  If you aren't using
# stubs, you also need to modify the SHLIB_LD_LIBS setting below to
# link against the non-stubbed Tcl library.  Add Tk too if necessary.
#--------------------------------------------------------------------

Name change from generic/intptr_t.h to generic/int2ptr_ptr2int.h.

Changes to generic/tdbcmysql.c.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
 *
 * $Id: $
 *
 *-----------------------------------------------------------------------------
 */

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#include <tcl.h>
#include <tclOO.h>
#include <tdbc.h>

#include <stdio.h>
#include <string.h>

#include "fakemysql.h"

/*
 * PTR2INT/INT2PTR
 */
#if defined(HAVE_STDINT_H) && defined(HAVE_INTPTR_T)
#  include <stdint.h>
#  include "intptr_t.h"
#endif

/* Static data contained in this file */

TCL_DECLARE_MUTEX(mysqlMutex);	/* Mutex protecting the global environment
				 * and its reference count */

static int mysqlRefCount = 0;	/* Reference count on the global environment */






|









|
|
|
|
|
|
|
<
<







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33


34
35
36
37
38
39
40
 *
 * $Id: $
 *
 *-----------------------------------------------------------------------------
 */

#ifdef _MSC_VER
#  define _CRT_SECURE_NO_WARNINGS
#endif

#include <tcl.h>
#include <tclOO.h>
#include <tdbc.h>

#include <stdio.h>
#include <string.h>

#ifdef HAVE_STDINT_H
#  include <stdint.h>
#endif

#include "int2ptr_ptr2int.h"

#include "fakemysql.h"



/* Static data contained in this file */

TCL_DECLARE_MUTEX(mysqlMutex);	/* Mutex protecting the global environment
				 * and its reference count */

static int mysqlRefCount = 0;	/* Reference count on the global environment */