From 8fa563c91c4fb1481c5d55485f88a803798adaf0 Mon Sep 17 00:00:00 2001 From: treectrl Date: Mon, 21 Jul 2008 18:35:38 +0000 Subject: Added debug code to detect use of uninitialized TreePtrList. --- generic/tkTreeUtils.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/generic/tkTreeUtils.c b/generic/tkTreeUtils.c index 3453e96..8681730 100644 --- a/generic/tkTreeUtils.c +++ b/generic/tkTreeUtils.c @@ -5,7 +5,7 @@ * * Copyright (c) 2002-2008 Tim Baker * - * RCS: @(#) $Id: tkTreeUtils.c,v 1.74 2008/01/22 01:03:02 treectrl Exp $ + * RCS: @(#) $Id: tkTreeUtils.c,v 1.75 2008/07/21 18:35:38 treectrl Exp $ */ #include "tkTreeCtrl.h" @@ -3812,6 +3812,9 @@ TreePtrList_Init( * 0 for default. */ ) { +#ifdef TREECTRL_DEBUG + strncpy(tplPtr->magic, "MAGC", 4); +#endif tplPtr->tree = tree; tplPtr->pointers = tplPtr->pointerSpace; tplPtr->count = 0; @@ -3847,6 +3850,10 @@ TreePtrList_Grow( int count /* Number of pointers the list should hold. */ ) { +#ifdef TREECTRL_DEBUG + if (strncmp(tplPtr->magic, "MAGC", 4) != 0) + panic("TreePtrList_Grow: using uninitialized list"); +#endif if (tplPtr->space >= count + 1) return; while (tplPtr->space < count + 1) @@ -3884,6 +3891,10 @@ TreePtrList_Append( ClientData pointer /* Item to append. */ ) { +#ifdef TREECTRL_DEBUG + if (strncmp(tplPtr->magic, "MAGC", 4) != 0) + panic("TreePtrList_Append: using uninitialized list"); +#endif TreePtrList_Grow(tplPtr, tplPtr->count + 1); tplPtr->pointers[tplPtr->count] = pointer; tplPtr->count++; @@ -3913,6 +3924,10 @@ TreePtrList_Concat( TreePtrList *tpl2Ptr /* Item list to append. */ ) { +#ifdef TREECTRL_DEBUG + if (strncmp(tplPtr->magic, "MAGC", 4) != 0) + panic("TreePtrList_Concat: using uninitialized list"); +#endif TreePtrList_Grow(tplPtr, tplPtr->count + tpl2Ptr->count); memcpy(tplPtr->pointers + tplPtr->count, tpl2Ptr->pointers, tpl2Ptr->count * sizeof(ClientData)); @@ -3942,6 +3957,10 @@ TreePtrList_Free( TreePtrList *tplPtr /* Structure describing pointer list. */ ) { +#ifdef TREECTRL_DEBUG + if (strncmp(tplPtr->magic, "MAGC", 4) != 0) + panic("TreePtrList_Free: using uninitialized list"); +#endif if (tplPtr->pointers != tplPtr->pointerSpace) { ckfree((char *) tplPtr->pointers); } -- cgit v0.12 orm>
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | | | Merge #16071: fix more email.message links in mailbox docs.R David Murray2012-09-281-6/+6
| |\ \ \ \ \ | | |/ / / /
| | * | | | #16071: fix more email.message links in mailbox docs.R David Murray2012-09-281-6/+6
| | | | | |
| * | | | | Merge #16071: fix links to email.message.Message in mailbox docs.R David Murray2012-09-281-3/+4
| |\ \ \ \ \ | | |/ / / /
| | * | | | #16071: fix links to email.message.Message in mailbox docs.R David Murray2012-09-281-3/+4
| | | | | |
| * | | | | Closes #16080: The decorator ignores failed attempts to set the requiredStefan Krah2012-09-281-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | locale, so an additional check is required.
| * | | | | MergeMichael Foord2012-09-281-8/+11
| |\ \ \ \ \
| | * | | | | Move NEWS items from 3.3.0 to that section, to ease merging from the release ↵Georg Brandl2012-09-281-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | clone later.
| * | | | | | Closes issue 15323. Improve failure message of Mock.assert_called_once_withMichael Foord2012-09-284-4/+13
| |/ / / / /
| * | | | | MERGE: Closes #15953: Incorrect some fields declaration in the PyTypeObject ↵Jesus Cea2012-09-28