Tcl Source Code

Artifact [19c6d191dc]
Login

Artifact 19c6d191dccefcf557b5abf30307774dba95a803:

Attachment "340.patch" to ticket [2315890fff] added by nijtmans 2008-11-20 04:59:53.
*** doc/SetResult.3.orig	Wed Nov 19 22:36:12 2008
--- doc/SetResult.3	Wed Nov 19 22:36:41 2008
***************
*** 196,212 ****
  If \fIfreeProc\fR is \fBTCL_STATIC\fR it means that \fIresult\fR
  refers to an area of static storage that is guaranteed not to be
  modified until at least the next call to \fBTcl_Eval\fR.
- If \fIfreeProc\fR
- is \fBTCL_DYNAMIC\fR it means that \fIresult\fR was allocated with a call
- to \fBTcl_Alloc\fR and is now the property of the Tcl system.
- \fBTcl_SetResult\fR will arrange for the string's storage to be
- released by calling \fBTcl_Free\fR when it is no longer needed.
  If \fIfreeProc\fR is \fBTCL_VOLATILE\fR it means that \fIresult\fR
  points to an area of memory that is likely to be overwritten when
  \fBTcl_SetResult\fR returns (e.g. it points to something in a stack frame).
  In this case \fBTcl_SetResult\fR will make a copy of the string in
  dynamically allocated storage and arrange for the copy to be the
  result for the current Tcl command.
  .PP
  If \fIfreeProc\fR is not one of the values \fBTCL_STATIC\fR,
  \fBTCL_DYNAMIC\fR, and \fBTCL_VOLATILE\fR, then it is the address
--- 196,220 ----
  If \fIfreeProc\fR is \fBTCL_STATIC\fR it means that \fIresult\fR
  refers to an area of static storage that is guaranteed not to be
  modified until at least the next call to \fBTcl_Eval\fR.
  If \fIfreeProc\fR is \fBTCL_VOLATILE\fR it means that \fIresult\fR
  points to an area of memory that is likely to be overwritten when
  \fBTcl_SetResult\fR returns (e.g. it points to something in a stack frame).
  In this case \fBTcl_SetResult\fR will make a copy of the string in
  dynamically allocated storage and arrange for the copy to be the
  result for the current Tcl command.
+ .PP
+ .SH "DEPRECATED VALUES FOR THE TCL_FREEPROC ARGUMENT TO TCL_SETRESULT"
+ Starting with Tcl 8.6, other values than \fBTCL_STATIC\f and
+ \fBTCL_VOLATILE\fR are deprecated. They still are documented
+ here for completeness, and in Tcl 8.6 they still work. However,
+ in the future support for this will be removed. For details
+ about that, see TIP #340.
+ .PP
+ If \fIfreeProc\fR
+ is \fBTCL_DYNAMIC\fR it means that \fIresult\fR was allocated with a call
+ to \fBTcl_Alloc\fR and is now the property of the Tcl system.
+ \fBTcl_SetResult\fR will arrange for the string's storage to be
+ released by calling \fBTcl_Free\fR when it is no longer needed.
  .PP
  If \fIfreeProc\fR is not one of the values \fBTCL_STATIC\fR,
  \fBTCL_DYNAMIC\fR, and \fBTCL_VOLATILE\fR, then it is the address
*** generic/tcl.decls.orig	Sat Nov 15 00:46:24 2008
--- generic/tcl.decls	Mon Nov 17 23:17:15 2008
***************
*** 822,828 ****
      int Tcl_SetRecursionLimit(Tcl_Interp *interp, int depth)
  }
  declare 232 generic {
!     void Tcl_SetResult(Tcl_Interp *interp, char *result,
  	    Tcl_FreeProc *freeProc)
  }
  declare 233 generic {
--- 822,828 ----
      int Tcl_SetRecursionLimit(Tcl_Interp *interp, int depth)
  }
  declare 232 generic {
!     void Tcl_SetResult(Tcl_Interp *interp, const char *result,
  	    Tcl_FreeProc *freeProc)
  }
  declare 233 generic {
*** generic/tclResult.c.orig	Sat Nov 15 00:48:42 2008
--- generic/tclResult.c	Sun Nov 16 23:23:38 2008
***************
*** 394,405 ****
  Tcl_SetResult(
      Tcl_Interp *interp,		/* Interpreter with which to associate the
  				 * return value. */
!     register char *result,	/* Value to be returned. If NULL, the result
  				 * is set to an empty string. */
      Tcl_FreeProc *freeProc)	/* Gives information about the string:
  				 * TCL_STATIC, TCL_VOLATILE, or the address of
  				 * a Tcl_FreeProc such as free. */
  {
      Interp *iPtr = (Interp *) interp;
      int length;
      register Tcl_FreeProc *oldFreeProc = iPtr->freeProc;
--- 394,405 ----
  Tcl_SetResult(
      Tcl_Interp *interp,		/* Interpreter with which to associate the
  				 * return value. */
!     const char *result, 	/* Value to be returned. If NULL, the result
  				 * is set to an empty string. */
      Tcl_FreeProc *freeProc)	/* Gives information about the string:
  				 * TCL_STATIC, TCL_VOLATILE, or the address of
  				 * a Tcl_FreeProc such as free. */
  {
      Interp *iPtr = (Interp *) interp;
      int length;
      register Tcl_FreeProc *oldFreeProc = iPtr->freeProc;
***************
*** 420,426 ****
  	}
  	strcpy(iPtr->result, result);
      } else {
! 	iPtr->result = result;
  	iPtr->freeProc = freeProc;
      }
  
--- 420,426 ----
  	}
  	strcpy(iPtr->result, result);
      } else {
! 	iPtr->result = (char *) result;
  	iPtr->freeProc = freeProc;
      }
  
*** win/tcl.m4.orig	Sat Nov 15 00:52:01 2008
--- win/tcl.m4	Sat Nov 15 00:52:24 2008
***************
*** 529,535 ****
  
  	CFLAGS_DEBUG=-g
  	CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
! 	CFLAGS_WARNING="-Wall"
  	LDFLAGS_DEBUG=
  	LDFLAGS_OPTIMIZE=
  
--- 529,535 ----
  
  	CFLAGS_DEBUG=-g
  	CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
! 	CFLAGS_WARNING="-Wall -Wwrite-strings"
  	LDFLAGS_DEBUG=
  	LDFLAGS_OPTIMIZE=
  
*** unix/tcl.m4.orig	Sat Nov 15 00:52:08 2008
--- unix/tcl.m4	Sat Nov 15 00:52:31 2008
***************
*** 1103,1109 ****
      CFLAGS_DEBUG=-g
      AS_IF([test "$GCC" = yes], [
  	CFLAGS_OPTIMIZE="-O2"
! 	CFLAGS_WARNING="-Wall"
      ], [
  	CFLAGS_OPTIMIZE=-O
  	CFLAGS_WARNING=""
--- 1103,1109 ----
      CFLAGS_DEBUG=-g
      AS_IF([test "$GCC" = yes], [
  	CFLAGS_OPTIMIZE="-O2"
! 	CFLAGS_WARNING="-Wall -Wwrite-strings"
      ], [
  	CFLAGS_OPTIMIZE=-O
  	CFLAGS_WARNING=""