Skip to content

Commit 32a2aa7

Browse files
committed
Add support for Tcl 9
Tcl 9 changed several API functions to take Tcl_Size, which is ptrdiff_t, instead of int, for 64-bit enablement. We have to change a few local variables to be compatible with that. We also provide a fallback typedef of Tcl_Size for older Tcl versions. The affected variables are used for quantities that will not approach values beyond the range of int, so this doesn't change any functionality. Reviewed-by: Tristan Partin <tristan@partin.io> Discussion: https://www.postgresql.org/message-id/flat/bce0fe54-75b4-438e-b42b-8e84bc7c0e9c%40eisentraut.org
1 parent bc5a4df commit 32a2aa7

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/pl/tcl/pltcl.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ PG_MODULE_MAGIC;
5555
#define CONST86
5656
#endif
5757

58+
#if !HAVE_TCL_VERSION(8,7)
59+
typedef int Tcl_Size;
60+
#endif
61+
5862
/* define our text domain for translations */
5963
#undef TEXTDOMAIN
6064
#define TEXTDOMAIN PG_TEXTDOMAIN("pltcl")
@@ -987,7 +991,7 @@ pltcl_func_handler(PG_FUNCTION_ARGS, pltcl_call_state *call_state,
987991
HeapTuple tup;
988992
Tcl_Obj *resultObj;
989993
Tcl_Obj **resultObjv;
990-
int resultObjc;
994+
Tcl_Size resultObjc;
991995

992996
/*
993997
* Set up data about result type. XXX it's tempting to consider
@@ -1063,7 +1067,7 @@ pltcl_trigger_handler(PG_FUNCTION_ARGS, pltcl_call_state *call_state,
10631067
int tcl_rc;
10641068
int i;
10651069
const char *result;
1066-
int result_Objc;
1070+
Tcl_Size result_Objc;
10671071
Tcl_Obj **result_Objv;
10681072
int rc PG_USED_FOR_ASSERTS_ONLY;
10691073

@@ -2089,7 +2093,7 @@ pltcl_quote(ClientData cdata, Tcl_Interp *interp,
20892093
char *tmp;
20902094
const char *cp1;
20912095
char *cp2;
2092-
int length;
2096+
Tcl_Size length;
20932097

20942098
/************************************************************
20952099
* Check call syntax
@@ -2283,7 +2287,7 @@ pltcl_returnnext(ClientData cdata, Tcl_Interp *interp,
22832287
if (prodesc->fn_retistuple)
22842288
{
22852289
Tcl_Obj **rowObjv;
2286-
int rowObjc;
2290+
Tcl_Size rowObjc;
22872291

22882292
/* result should be a list, so break it down */
22892293
if (Tcl_ListObjGetElements(interp, objv[1], &rowObjc, &rowObjv) == TCL_ERROR)
@@ -2625,7 +2629,7 @@ pltcl_SPI_prepare(ClientData cdata, Tcl_Interp *interp,
26252629
int objc, Tcl_Obj *const objv[])
26262630
{
26272631
volatile MemoryContext plan_cxt = NULL;
2628-
int nargs;
2632+
Tcl_Size nargs;
26292633
Tcl_Obj **argsObj;
26302634
pltcl_query_desc *qdesc;
26312635
int i;
@@ -2763,7 +2767,7 @@ pltcl_SPI_execute_plan(ClientData cdata, Tcl_Interp *interp,
27632767
const char *arrayname = NULL;
27642768
Tcl_Obj *loop_body = NULL;
27652769
int count = 0;
2766-
int callObjc;
2770+
Tcl_Size callObjc;
27672771
Tcl_Obj **callObjv = NULL;
27682772
Datum *argvalues;
27692773
MemoryContext oldcontext = CurrentMemoryContext;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy