summaryrefslogtreecommitdiffstats
path: root/generic/tclGetDate.y
diff options
context:
space:
mode:
authorkennykb <kennykb@noemail.net>2003-05-15 21:51:46 (GMT)
committerkennykb <kennykb@noemail.net>2003-05-15 21:51:46 (GMT)
commite60e87eed45dcbc04d73a8f58e3e8e39991c0be0 (patch)
tree49e0fa2a9af827e2b90a9260b0cbb7364e6a0f7a /generic/tclGetDate.y
parent682da4226babdb363b68dc873683d39b3770076f (diff)
downloadtcl-e60e87eed45dcbc04d73a8f58e3e8e39991c0be0.zip
tcl-e60e87eed45dcbc04d73a8f58e3e8e39991c0be0.tar.gz
tcl-e60e87eed45dcbc04d73a8f58e3e8e39991c0be0.tar.bz2
Fixed Tcl bug 736425
FossilOrigin-Name: a0e49ff76f88d363d2a84056ed50a3932d78cea7
Diffstat (limited to 'generic/tclGetDate.y')
-rw-r--r--generic/tclGetDate.y84
1 files changed, 83 insertions, 1 deletions
diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y
index 14b9869..3a7d032 100644
--- a/generic/tclGetDate.y
+++ b/generic/tclGetDate.y
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclGetDate.y,v 1.18 2001/10/18 20:20:28 hobbs Exp $
+ * RCS: @(#) $Id: tclGetDate.y,v 1.19 2003/05/15 21:51:46 kennykb Exp $
*/
%{
@@ -134,6 +134,88 @@ static int yylex _ANSI_ARGS_((void));
int
yyparse _ANSI_ARGS_((void));
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TclDateCleanup --
+ *
+ * Clean up allocated memory on process exit.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Frees the block of memory passed in as client data.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+TclDateCleanup( ClientData clientData )
+{
+ ckfree( (char*) clientData );
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TclDateAlloc --
+ *
+ * Special purpose allocator for the two YACC stacks.
+ *
+ * Results:
+ * Returns a pointer to a block of memory.
+ *
+ * Side effects:
+ * Allocates the requested number of bytes, and
+ * sets up to delete the allocated memory on process exit.
+ *
+ * The YACC system is set up to free memory in its stacks only by
+ * abandonment. This procedure sets up to free it explicitly on exit
+ * from Tcl, as when unloading.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static char*
+TclDateAlloc( size_t n )
+{
+ char* pointer = ckalloc( n );
+ Tcl_CreateExitHandler( TclDateCleanup, (ClientData) pointer );
+ return pointer;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TclDateRealloc --
+ *
+ * Special purpose allocator for the two YACC stacks.
+ *
+ * Results:
+ * Returns a pointer to a block of memory.
+ *
+ * Side effects:
+ * Allocates the requested number of bytes, and
+ * sets up to delete the allocated memory on process exit.
+ *
+ * The YACC system is set up to free memory in its stacks only by
+ * abandonment. This procedure sets up to free it explicitly on exit
+ * from Tcl, as when unloading.
+ *
+ *----------------------------------------------------------------------
+ */
+static char*
+TclDateRealloc( char* oldPointer, size_t n )
+{
+ char* newPointer;
+ Tcl_DeleteExitHandler( TclDateCleanup, (ClientData) oldPointer );
+ newPointer = ckrealloc( oldPointer, n );
+ Tcl_CreateExitHandler( TclDateCleanup, (ClientData) newPointer );
+ return newPointer;
+}
+
%}
%union {