File: init.diff

package info (click to toggle)
tcludp 1.0.12~1%2Bf8c3d67de2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 968 kB
  • sloc: ansic: 2,075; sh: 503; tcl: 221; makefile: 41
file content (46 lines) | stat: -rw-r--r-- 1,109 bytes parent folder | download
1
2
3
4
5
6
7
8
9
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
43
44
45
46
From: Sergei Golovan
Description: Implement loading into either Tcl 8 or Tcl 9
Date: Thu, 20 Mar 2025 14:59:24 +0300

--- a/generic/udp_tcl.c
+++ b/generic/udp_tcl.c
@@ -138,6 +138,13 @@
  * udpInit
  * ----------------------------------------------------------------------
  */
+
+#if TCL_MAJOR_VERSION > 8
+#define MIN_VERSION "9.0"
+#else
+#define MIN_VERSION "8.5"
+#endif
+
 int
 Udp_Init(Tcl_Interp *interp)
 {
@@ -147,7 +154,9 @@
 #endif
 
 #ifdef USE_TCL_STUBS
-    Tcl_InitStubs(interp, "8.1", 0);
+    if (Tcl_InitStubs(interp, MIN_VERSION, 0) == NULL) {
+        return TCL_ERROR;
+    }
 #endif
 
 #ifdef WIN32
--- a/pkgIndex.tcl.in
+++ b/pkgIndex.tcl.in
@@ -1,5 +1,10 @@
 #
 # Tcl package index file
 #
-package ifneeded @PACKAGE_NAME@ @PACKAGE_VERSION@ \
-    [list load [file join $dir @PKG_LIB_FILE@]]
+if {[package vsatisfies [package provide Tcl] 9.0-]} {
+    package ifneeded @PACKAGE_NAME@ @PACKAGE_VERSION@ \
+        [list load [file join $dir @PKG_LIB_FILE9@]]
+} else {
+    package ifneeded @PACKAGE_NAME@ @PACKAGE_VERSION@ \
+        [list load [file join $dir @PKG_LIB_FILE8@]]
+}