Tk Source Code

Check-in [3bd14b19]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Make revised_text build when TK_CHECK_ALLOCS is defined.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | revised_text | tip-466
Files: files | file ages | folders
SHA3-256: 3bd14b19c6c114399f5e8b56ff0e011f0a2e94ec997340d20bac114eeae09a08
User & Date: fvogel 2024-12-05 21:32:05
Context
2024-12-07
11:17
Better identify the output of TK_CHECK_ALLOCS results from tkText and tkTextDisp. check-in: 23b87937 user: fvogel tags: revised_text, tip-466
2024-12-05
21:32
Make revised_text build when TK_CHECK_ALLOCS is defined. check-in: 3bd14b19 user: fvogel tags: revised_text, tip-466
2024-11-30
16:56
Provide a potential fallback for proc menubarheight. check-in: bf3a9da6 user: fvogel tags: revised_text, tip-466
Changes
Unified Diff Ignore Whitespace Patch
Changes to generic/tkBitField.h.
1
2
3
4
5
6
7
8
9
10
11
12
13


14
15
16
17
18
19
20
/*
 * tkBitField.h --
 *
 *	This module implements bit field operations.
 *
 * Copyright © 2015-2017 Gregor Cramer
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */

#ifndef _TKBITFIELD
#define _TKBITFIELD



#include "tkInt.h" /* needed for inline support and 64 bit support */

#if (UINTPTR_MAX >= 0xffffffffffffffffu)
 /* This is a real 64 bit architecture. */
#   define TK_IS_64_BIT_ARCH
#endif













>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
 * tkBitField.h --
 *
 *	This module implements bit field operations.
 *
 * Copyright © 2015-2017 Gregor Cramer
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */

#ifndef _TKBITFIELD
#define _TKBITFIELD

/* #define TK_CHECK_ALLOCS */

#include "tkInt.h" /* needed for inline support and 64 bit support */

#if (UINTPTR_MAX >= 0xffffffffffffffffu)
 /* This is a real 64 bit architecture. */
#   define TK_IS_64_BIT_ARCH
#endif
Changes to generic/tkIntSet.h.
1
2
3
4
5
6
7
8
9
10
11
12
13


14
15
16
17
18
19
20
/*
 * tkSet.h --
 *
 *	This module implements an integer set.
 *
 * Copyright © 2015-2017 Gregor Cramer
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */

#ifndef _TKINTSET
#define _TKINTSET



#include "tkInt.h" /* required for inline support */

#if defined(__GNUC__) || defined(__clang__)
# define __warn_unused__ __attribute__((warn_unused_result))
#else
# define __warn_unused__













>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
 * tkSet.h --
 *
 *	This module implements an integer set.
 *
 * Copyright © 2015-2017 Gregor Cramer
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */

#ifndef _TKINTSET
#define _TKINTSET

/* #define TK_CHECK_ALLOCS */

#include "tkInt.h" /* required for inline support */

#if defined(__GNUC__) || defined(__clang__)
# define __warn_unused__ __attribute__((warn_unused_result))
#else
# define __warn_unused__
Changes to generic/tkRangeList.h.
10
11
12
13
14
15
16


17
18
19
20
21
22
23
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */

#ifndef _TKRANGELIST
#define _TKRANGELIST



#include "tkInt.h" /* required for inline support */

#if defined(__GNUC__) || defined(__clang__)
# define __warn_unused__ __attribute__((warn_unused_result))
#else
# define __warn_unused__







>
>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */

#ifndef _TKRANGELIST
#define _TKRANGELIST

/* #define TK_CHECK_ALLOCS */

#include "tkInt.h" /* required for inline support */

#if defined(__GNUC__) || defined(__clang__)
# define __warn_unused__ __attribute__((warn_unused_result))
#else
# define __warn_unused__
Changes to generic/tkText.c.
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
    struct WatchShared *nextPtr;
} WatchShared;

static unsigned widgetNumber = 0;
static WatchShared *watchShared;

static void
AllocStatistic()
{
    const WatchShared *wShared;

    if (!tkBTreeDebug) {
	return;
    }

    for (wShared = watchShared; wShared; wShared = wShared->nextPtr) {
	const TkText *peer;

	for (peer = wShared->sharedTextPtr->peers; peer; peer = peer->next) {
	    fprintf(stderr, "Unreleased text widget %d\n", peer->widgetNumber);
	}
    }

    fprintf(stderr, "---------------------------------\n");
    fprintf(stderr, "ALLOCATION:        new    destroy\n");
    fprintf(stderr, "---------------------------------\n");
    fprintf(stderr, "Shared:       %8u - %8u\n", tkTextCountNewShared, tkTextCountDestroyShared);







|











|







623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
    struct WatchShared *nextPtr;
} WatchShared;

static unsigned widgetNumber = 0;
static WatchShared *watchShared;

static void
AllocStatistic(void)
{
    const WatchShared *wShared;

    if (!tkBTreeDebug) {
	return;
    }

    for (wShared = watchShared; wShared; wShared = wShared->nextPtr) {
	const TkText *peer;

	for (peer = wShared->sharedTextPtr->peers; peer; peer = peer->next) {
	    fprintf(stderr, "Unreleased text widget %zd\n", peer->widgetNumber);
	}
    }

    fprintf(stderr, "---------------------------------\n");
    fprintf(stderr, "ALLOCATION:        new    destroy\n");
    fprintf(stderr, "---------------------------------\n");
    fprintf(stderr, "Shared:       %8u - %8u\n", tkTextCountNewShared, tkTextCountDestroyShared);
Changes to generic/tkText.h.
9
10
11
12
13
14
15


16
17
18
19
20
21
22
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */

#ifndef _TKTEXT
#define _TKTEXT



#ifndef _TKINT
# include "tkInt.h"
#endif

/* Support of assertion handler. */
#define CATCH_ASSERTION_FAILED 0







>
>







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */

#ifndef _TKTEXT
#define _TKTEXT

/* #define TK_CHECK_ALLOCS */

#ifndef _TKINT
# include "tkInt.h"
#endif

/* Support of assertion handler. */
#define CATCH_ASSERTION_FAILED 0
Changes to generic/tkTextDisp.c.
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863

    int perfFuncIsHooked;
} Statistic;

static Statistic stats;

static void
PerfStatistic()
{
    if (!tkBTreeDebug) {
	return;
    }

    fprintf(stderr, "PERFORMANCE -------------------\n");
    fprintf(stderr, "Calls to DisplayText:    %6u\n", stats.numRedisplays);







|







849
850
851
852
853
854
855
856
857
858
859
860
861
862
863

    int perfFuncIsHooked;
} Statistic;

static Statistic stats;

static void
PerfStatistic(void)
{
    if (!tkBTreeDebug) {
	return;
    }

    fprintf(stderr, "PERFORMANCE -------------------\n");
    fprintf(stderr, "Calls to DisplayText:    %6u\n", stats.numRedisplays);
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913

extern unsigned tkRangeListCountNew;
extern unsigned tkRangeListCountDestroy;

static int hookStatFunc = 1;

static void
AllocStatistic()
{
    if (!tkBTreeDebug) {
	return;
    }

    fprintf(stderr, "--------------------------------\n");
    fprintf(stderr, "ALLOCATION:       new    destroy\n");







|







899
900
901
902
903
904
905
906
907
908
909
910
911
912
913

extern unsigned tkRangeListCountNew;
extern unsigned tkRangeListCountDestroy;

static int hookStatFunc = 1;

static void
AllocStatistic(void)
{
    if (!tkBTreeDebug) {
	return;
    }

    fprintf(stderr, "--------------------------------\n");
    fprintf(stderr, "ALLOCATION:       new    destroy\n");
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
    if (hookStatFunc) {
	atexit(AllocStatistic);
	hookStatFunc = 0;
    }
#endif
#ifndef NDEBUG
    if (!stats.perfFuncIsHooked) {
#ifndef _MSC_VER	/* MSVC erroneously triggers warning warning C4113 */
	atexit(PerfStatistic);
#endif
	stats.perfFuncIsHooked = 1;
    }
#endif
}
/*
 *----------------------------------------------------------------------
 *







<

<







1658
1659
1660
1661
1662
1663
1664

1665

1666
1667
1668
1669
1670
1671
1672
    if (hookStatFunc) {
	atexit(AllocStatistic);
	hookStatFunc = 0;
    }
#endif
#ifndef NDEBUG
    if (!stats.perfFuncIsHooked) {

	atexit(PerfStatistic);

	stats.perfFuncIsHooked = 1;
    }
#endif
}
/*
 *----------------------------------------------------------------------
 *