Description: Uses API functions to access result in Tcl_interp.
 Replaces deprecated direct access of field result in Tcl_interp structure
 with Tcl_GetStringResult / Tcl_SetResult fixing FTBFS.
Author: Sebastian Carneiro <scarneiro@fibertel.com.ar>
Bug: <URL to the upstream bug report if any, implies patch has been forwarded, optional>
Bug-Debian: https://bugs.debian.org/743074
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1303405
Forwarded: yes
Last-Update: 2014-04-06
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
Index: fix-for-ftbfs/nspostgres.c
===================================================================
--- fix-for-ftbfs.orig/nspostgres.c	2014-04-06 00:32:53.467854019 -0300
+++ fix-for-ftbfs/nspostgres.c	2014-04-06 00:35:35.420657098 -0300
@@ -31,6 +31,7 @@
 
 #include "nspostgres.h"
 #include <tcl.h>
+#include <tclDecls.h>
 
 DllExport int   Ns_ModuleVersion = 1;
 
@@ -1760,6 +1761,8 @@
         return TCL_ERROR;
     }
 
+    char * interp_result = Tcl_GetStringResult(interp);
+
     if (!strcmp(argv[1], "db")) {
         Tcl_SetResult(interp, (char *) PQdb(nspgConn->conn), TCL_STATIC);
     } else if (!strcmp(argv[1], "host")) {
@@ -1769,15 +1772,15 @@
     } else if (!strcmp(argv[1], "port")) {
         Tcl_SetResult(interp, (char *) PQport(nspgConn->conn), TCL_STATIC);
     } else if (!strcmp(argv[1], "number")) {
-        sprintf(interp->result, "%u", nspgConn->cNum);
+        sprintf(interp_result, "%u", nspgConn->cNum);
     } else if (!strcmp(argv[1], "error")) {
         Tcl_SetResult(interp, (char *) PQerrorMessage(nspgConn->conn),
 			 TCL_STATIC);
     } else if (!strcmp(argv[1], "status")) {
         if (PQstatus(nspgConn->conn) == CONNECTION_OK) {
-            interp->result = "ok";
+            Tcl_SetResult(interp, "ok", TCL_VOLATILE);
         } else {
-            interp->result = "bad";
+            Tcl_SetResult(interp, "bad", TCL_VOLATILE);
         }
     } else if (!strcmp(argv[1], "ntuples")) {
 	char string[16];
@@ -1982,7 +1985,8 @@
 			      argv[0], " ", argv[1], " dbId table\"", NULL);
 	    goto bailout;
 	  }
-	sprintf (interp->result, "%d", tinfo->ncolumns);
+	char * interp_result = Tcl_GetStringResult(interp);
+	sprintf (interp_result, "%d", tinfo->ncolumns);
 
       } 
     else if (!strcmp(argv[1], "exists")) 
