From e5cd963c59b6bd893f48e2ce7f72b6b7dc19bb76 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 14 Sep 2017 08:05:32 +0000 Subject: Remove some unnecessary #if 0 sections. Fix comments and panic messages. No functional changes. --- generic/tclHash.c | 13 ------- generic/tclTomMath.h | 2 +- generic/tclTomMathInterface.c | 81 ++----------------------------------------- 3 files changed, 4 insertions(+), 92 deletions(-) diff --git a/generic/tclHash.c b/generic/tclHash.c index 78ad514..3c820c0 100644 --- a/generic/tclHash.c +++ b/generic/tclHash.c @@ -46,19 +46,6 @@ static int CompareArrayKeys(void *keyPtr, Tcl_HashEntry *hPtr); static TCL_HASH_TYPE HashArrayKey(Tcl_HashTable *tablePtr, void *keyPtr); /* - * Prototypes for the one word hash key methods. Not actually declared because - * this is a critical path that is implemented in the core hash table access - * function. - */ - -#if 0 -static Tcl_HashEntry * AllocOneWordEntry(Tcl_HashTable *tablePtr, - void *keyPtr); -static int CompareOneWordKeys(void *keyPtr, Tcl_HashEntry *hPtr); -static unsigned int HashOneWordKey(Tcl_HashTable *tablePtr, void *keyPtr); -#endif - -/* * Prototypes for the string hash key methods. */ diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h index 2ce8194..f110490 100644 --- a/generic/tclTomMath.h +++ b/generic/tclTomMath.h @@ -27,7 +27,7 @@ extern "C" { #endif /* detect 64-bit mode if possible */ -#if defined(NEVER) +#if defined(NEVER) /* 128-bit ints fail in too many places */ #if !(defined(MP_32BIT) || defined(MP_16BIT) || defined(MP_8BIT)) #define MP_64BIT #endif diff --git a/generic/tclTomMathInterface.c b/generic/tclTomMathInterface.c index 78888a7..9e7bf4b 100644 --- a/generic/tclTomMathInterface.c +++ b/generic/tclTomMathInterface.c @@ -89,81 +89,6 @@ TclBN_revision(void) { return TCLTOMMATH_REVISION; } -#if 0 - -/* - *---------------------------------------------------------------------- - * - * TclBNAlloc -- - * - * Allocate memory for libtommath. - * - * Results: - * Returns a pointer to the allocated block. - * - * This procedure is a wrapper around Tcl_Alloc, needed because of a - * mismatched type signature between Tcl_Alloc and malloc. - * - *---------------------------------------------------------------------- - */ - -extern void * -TclBNAlloc( - size_t x) -{ - return (void *) ckalloc((unsigned int) x); -} - -/* - *---------------------------------------------------------------------- - * - * TclBNRealloc -- - * - * Change the size of an allocated block of memory in libtommath - * - * Results: - * Returns a pointer to the allocated block. - * - * This procedure is a wrapper around Tcl_Realloc, needed because of a - * mismatched type signature between Tcl_Realloc and realloc. - * - *---------------------------------------------------------------------- - */ - -void * -TclBNRealloc( - void *p, - size_t s) -{ - return (void *) ckrealloc((char *) p, (unsigned int) s); -} - -/* - *---------------------------------------------------------------------- - * - * TclBNFree -- - * - * Free allocated memory in libtommath. - * - * Results: - * None. - * - * Side effects: - * Memory is freed. - * - * This function is simply a wrapper around Tcl_Free, needed in libtommath - * because of a type mismatch between free and Tcl_Free. - * - *---------------------------------------------------------------------- - */ - -extern void -TclBNFree( - void *p) -{ - ckree((char *) p); -} -#endif /* *---------------------------------------------------------------------- @@ -187,7 +112,7 @@ TclInitBignumFromLong( long v) { if (mp_init_size(a, (CHAR_BIT * sizeof(long) + DIGIT_BIT - 1) / DIGIT_BIT) != MP_OKAY) { - Tcl_Panic("initialization failure in TclBNInitBignumFromLong"); + Tcl_Panic("initialization failure in TclInitBignumFromLong"); } if (v < (long)0) { mp_set_long_long(a, (Tcl_WideUInt)(-(Tcl_WideInt)v)); @@ -219,7 +144,7 @@ TclInitBignumFromWideInt( Tcl_WideInt v) /* Initial value */ { if (mp_init_size(a, (CHAR_BIT * sizeof(Tcl_WideUInt) + DIGIT_BIT - 1) / DIGIT_BIT) != MP_OKAY) { - Tcl_Panic("initialization failure in TclBNInitBignumFromWideInt"); + Tcl_Panic("initialization failure in TclInitBignumFromWideInt"); } if (v < (Tcl_WideInt)0) { mp_set_long_long(a, (Tcl_WideUInt)(-v)); @@ -251,7 +176,7 @@ TclInitBignumFromWideUInt( Tcl_WideUInt v) /* Initial value */ { if (mp_init_size(a, (CHAR_BIT * sizeof(Tcl_WideUInt) + DIGIT_BIT - 1) / DIGIT_BIT) != MP_OKAY) { - Tcl_Panic("initialization failure in TclBNInitBignumFromWideUInt"); + Tcl_Panic("initialization failure in TclInitBignumFromWideUInt"); } mp_set_long_long(a, v); } -- cgit v0.12