From 0a2235e7ad8b6e55a3940f284cd44db30dcab056 Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 20 Mar 2008 09:49:15 +0000 Subject: Final clean up of the Tcl_GetMemoryInfo mess. --- ChangeLog | 8 ++++++++ generic/tcl.h | 52 ++++++++++++++++++++++++------------------------ generic/tclThreadAlloc.c | 29 ++++++++++++++++++++++++--- 3 files changed, 60 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index f31e2ca..cc5c7f7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-03-20 Donal K. Fellows + + * generic/tcl.h, generic/tclThreadAlloc.c: Tidied up the declarations + of Tcl_GetMemoryInfo so that it is always defined. Will panic when + called against a Tcl that was previously built without it at all, + which is OK because that also indicates a serious mismatch between + memory configuration options. + 2008-03-19 Donal K. Fellows * generic/tcl.h, generic/tclThreadAlloc.c (Tcl_GetMemoryInfo): Make diff --git a/generic/tcl.h b/generic/tcl.h index 7f33d22..9f6a951 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tcl.h,v 1.251 2008/03/19 16:02:05 dkf Exp $ + * RCS: @(#) $Id: tcl.h,v 1.252 2008/03/20 09:49:15 dkf Exp $ */ #ifndef _TCL @@ -823,10 +823,10 @@ typedef struct Tcl_Namespace { * starts with ::. */ ClientData clientData; /* Arbitrary value associated with this * namespace. */ - Tcl_NamespaceDeleteProc* deleteProc; + Tcl_NamespaceDeleteProc *deleteProc; /* Function invoked when deleting the * namespace to, e.g., free clientData. */ - struct Tcl_Namespace* parentPtr; + struct Tcl_Namespace *parentPtr; /* Points to the namespace that contains this * one. NULL if this is the global * namespace. */ @@ -1337,8 +1337,10 @@ typedef int (Tcl_WaitForEventProc) _ANSI_ARGS_((Tcl_Time *timePtr)); * TIP #233 (Virtualized Time) */ -typedef void (Tcl_GetTimeProc) _ANSI_ARGS_ ((Tcl_Time* timebuf, ClientData clientData)); -typedef void (Tcl_ScaleTimeProc) _ANSI_ARGS_ ((Tcl_Time* timebuf, ClientData clientData)); +typedef void (Tcl_GetTimeProc) _ANSI_ARGS_((Tcl_Time *timebuf, + ClientData clientData)); +typedef void (Tcl_ScaleTimeProc) _ANSI_ARGS_((Tcl_Time *timebuf, + ClientData clientData)); /* * Bits to pass to Tcl_CreateFileHandler and Tcl_CreateChannelHandler to @@ -1584,10 +1586,10 @@ typedef int (Tcl_FSStatProc) _ANSI_ARGS_((Tcl_Obj *pathPtr, Tcl_StatBuf *buf)); typedef int (Tcl_FSAccessProc) _ANSI_ARGS_((Tcl_Obj *pathPtr, int mode)); typedef Tcl_Channel (Tcl_FSOpenFileChannelProc) _ANSI_ARGS_(( Tcl_Interp *interp, Tcl_Obj *pathPtr, int mode, int permissions)); -typedef int (Tcl_FSMatchInDirectoryProc) _ANSI_ARGS_((Tcl_Interp* interp, +typedef int (Tcl_FSMatchInDirectoryProc) _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *result, Tcl_Obj *pathPtr, CONST char *pattern, Tcl_GlobTypeData * types)); -typedef Tcl_Obj* (Tcl_FSGetCwdProc) _ANSI_ARGS_((Tcl_Interp *interp)); +typedef Tcl_Obj * (Tcl_FSGetCwdProc) _ANSI_ARGS_((Tcl_Interp *interp)); typedef int (Tcl_FSChdirProc) _ANSI_ARGS_((Tcl_Obj *pathPtr)); typedef int (Tcl_FSLstatProc) _ANSI_ARGS_((Tcl_Obj *pathPtr, Tcl_StatBuf *buf)); @@ -1602,7 +1604,7 @@ typedef int (Tcl_FSRemoveDirectoryProc) _ANSI_ARGS_((Tcl_Obj *pathPtr, typedef int (Tcl_FSRenameFileProc) _ANSI_ARGS_((Tcl_Obj *srcPathPtr, Tcl_Obj *destPathPtr)); typedef void (Tcl_FSUnloadFileProc) _ANSI_ARGS_((Tcl_LoadHandle loadHandle)); -typedef Tcl_Obj* (Tcl_FSListVolumesProc) _ANSI_ARGS_((void)); +typedef Tcl_Obj * (Tcl_FSListVolumesProc) _ANSI_ARGS_((void)); /* We have to declare the utime structure here. */ struct utimbuf; typedef int (Tcl_FSUtimeProc) _ANSI_ARGS_((Tcl_Obj *pathPtr, @@ -1611,25 +1613,25 @@ typedef int (Tcl_FSNormalizePathProc) _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *pathPtr, int nextCheckpoint)); typedef int (Tcl_FSFileAttrsGetProc) _ANSI_ARGS_((Tcl_Interp *interp, int index, Tcl_Obj *pathPtr, Tcl_Obj **objPtrRef)); -typedef CONST char** (Tcl_FSFileAttrStringsProc) _ANSI_ARGS_(( - Tcl_Obj *pathPtr, Tcl_Obj** objPtrRef)); +typedef CONST char ** (Tcl_FSFileAttrStringsProc) _ANSI_ARGS_(( + Tcl_Obj *pathPtr, Tcl_Obj **objPtrRef)); typedef int (Tcl_FSFileAttrsSetProc) _ANSI_ARGS_((Tcl_Interp *interp, int index, Tcl_Obj *pathPtr, Tcl_Obj *objPtr)); -typedef Tcl_Obj* (Tcl_FSLinkProc) _ANSI_ARGS_((Tcl_Obj *pathPtr, +typedef Tcl_Obj * (Tcl_FSLinkProc) _ANSI_ARGS_((Tcl_Obj *pathPtr, Tcl_Obj *toPtr, int linkType)); typedef int (Tcl_FSLoadFileProc) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj *pathPtr, Tcl_LoadHandle *handlePtr, Tcl_FSUnloadFileProc **unloadProcPtr)); typedef int (Tcl_FSPathInFilesystemProc) _ANSI_ARGS_((Tcl_Obj *pathPtr, ClientData *clientDataPtr)); -typedef Tcl_Obj* (Tcl_FSFilesystemPathTypeProc) _ANSI_ARGS_(( +typedef Tcl_Obj * (Tcl_FSFilesystemPathTypeProc) _ANSI_ARGS_(( Tcl_Obj *pathPtr)); -typedef Tcl_Obj* (Tcl_FSFilesystemSeparatorProc) _ANSI_ARGS_(( +typedef Tcl_Obj * (Tcl_FSFilesystemSeparatorProc) _ANSI_ARGS_(( Tcl_Obj *pathPtr)); typedef void (Tcl_FSFreeInternalRepProc) _ANSI_ARGS_((ClientData clientData)); typedef ClientData (Tcl_FSDupInternalRepProc) _ANSI_ARGS_(( ClientData clientData)); -typedef Tcl_Obj* (Tcl_FSInternalToNormalizedProc) _ANSI_ARGS_(( +typedef Tcl_Obj * (Tcl_FSInternalToNormalizedProc) _ANSI_ARGS_(( ClientData clientData)); typedef ClientData (Tcl_FSCreateInternalRepProc) _ANSI_ARGS_(( Tcl_Obj *pathPtr)); @@ -2204,8 +2206,9 @@ typedef unsigned long mp_digit; EXTERN CONST char * Tcl_InitStubs _ANSI_ARGS_((Tcl_Interp *interp, CONST char *version, int exact)); -EXTERN CONST char* TclTomMathInitializeStubs(Tcl_Interp* interp, - CONST char* version, int epoch, int revision); +EXTERN CONST char * TclTomMathInitializeStubs _ANSI_ARGS_(( + Tcl_Interp *interp, CONST char *version, + int epoch, int revision); #ifndef USE_TCL_STUBS @@ -2225,19 +2228,16 @@ EXTERN CONST char* TclTomMathInitializeStubs(Tcl_Interp* interp, /* * Public functions that are not accessible via the stubs table. - */ - -EXTERN void Tcl_Main _ANSI_ARGS_((int argc, char **argv, - Tcl_AppInitProc *appInitProc)); - -EXTERN CONST char *Tcl_PkgInitStubsCheck _ANSI_ARGS_((Tcl_Interp *interp, - CONST char *version, int exact)); - -/* * Tcl_GetMemoryInfo is needed for AOLserver. [Bug 1868171] */ -EXTERN void Tcl_GetMemoryInfo _ANSI_ARGS_((Tcl_DString *dsPtr)); +EXTERN void Tcl_Main _ANSI_ARGS_((int argc, char **argv, + Tcl_AppInitProc *appInitProc)); +EXTERN CONST char * Tcl_PkgInitStubsCheck _ANSI_ARGS_((Tcl_Interp *interp, + CONST char *version, int exact)); +#if defined(TCL_THREADS) && defined(USE_THREAD_ALLOC) +EXTERN void Tcl_GetMemoryInfo _ANSI_ARGS_((Tcl_DString *dsPtr)); +#endif /* * Include the public function declarations that are accessible via the stubs diff --git a/generic/tclThreadAlloc.c b/generic/tclThreadAlloc.c index f2a043c..0850d66 100755 --- a/generic/tclThreadAlloc.c +++ b/generic/tclThreadAlloc.c @@ -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: tclThreadAlloc.c,v 1.26 2008/03/19 16:02:05 dkf Exp $ + * RCS: @(#) $Id: tclThreadAlloc.c,v 1.27 2008/03/20 09:49:16 dkf Exp $ */ #include "tclInt.h" @@ -986,7 +986,30 @@ TclFinalizeThreadAlloc(void) TclpFreeAllocCache(NULL); } -#else +#else /* !(TCL_THREADS && USE_THREAD_ALLOC) */ +/* + *---------------------------------------------------------------------- + * + * Tcl_GetMemoryInfo -- + * + * Return a list-of-lists of memory stats. + * + * Results: + * None. + * + * Side effects: + * List appended to given dstring. + * + *---------------------------------------------------------------------- + */ + +void +Tcl_GetMemoryInfo( + Tcl_DString *dsPtr) +{ + Tcl_Panic("Tcl_GetMemoryInfo called when threaded memory allocator not in use"); +} + /* *---------------------------------------------------------------------- * @@ -1009,7 +1032,7 @@ TclFinalizeThreadAlloc(void) { Tcl_Panic("TclFinalizeThreadAlloc called when threaded memory allocator not in use"); } -#endif /* TCL_THREADS */ +#endif /* TCL_THREADS && USE_THREAD_ALLOC */ /* * Local Variables: -- cgit v0.12