diff options
author | dgp <dgp@users.sourceforge.net> | 2006-12-01 14:31:17 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2006-12-01 14:31:17 (GMT) |
commit | 84e12e85c42e0e68ff5aa6b331aa0d53962f7c5a (patch) | |
tree | 399de1866a806b933dcc90269909728680e3553d /generic/tclObj.c | |
parent | 426b5e333ff956b1b4b7306157c877ccee9093c5 (diff) | |
download | tcl-84e12e85c42e0e68ff5aa6b331aa0d53962f7c5a.zip tcl-84e12e85c42e0e68ff5aa6b331aa0d53962f7c5a.tar.gz tcl-84e12e85c42e0e68ff5aa6b331aa0d53962f7c5a.tar.bz2 |
TIP#298 IMPLEMENTATION
* generic/tcl.decls: Tcl_GetBignumAndClearObj -> Tcl_TakeBignumFromObj.
* generic/tclObj.c:
* generic/tclDecls.h: make genstubs
* generic/tclStubInit.c:
* generic/tclExecute.c: Update callers.
* generic/tclMathOp.c:
Diffstat (limited to 'generic/tclObj.c')
-rw-r--r-- | generic/tclObj.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/generic/tclObj.c b/generic/tclObj.c index 7aac447..58a964a 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclObj.c,v 1.115 2006/11/15 20:08:45 dgp Exp $ + * RCS: @(#) $Id: tclObj.c,v 1.116 2006/12/01 14:31:19 dgp Exp $ */ #include "tclInt.h" @@ -2744,12 +2744,6 @@ Tcl_DbNewBignumObj( *---------------------------------------------------------------------- */ -/* - * TODO: Consider a smarter Tcl_GetBignumAndClearObj() that doesn't - * require caller to check for a shared Tcl_Obj, but falls back to - * Tcl_GetBignumFromObj() when sharing is an issue. - */ - static int GetBignumFromObj( Tcl_Interp *interp, /* Tcl interpreter for error reporting */ @@ -2759,14 +2753,11 @@ GetBignumFromObj( { do { if (objPtr->typePtr == &tclBignumType) { - if (copy) { + if (copy || Tcl_IsShared(objPtr)) { mp_int temp; UNPACK_BIGNUM(objPtr, temp); mp_init_copy(bignumValue, &temp); } else { - if (Tcl_IsShared(objPtr)) { - Tcl_Panic("Tcl_GetBignumAndClearObj called on shared Tcl_Obj"); - } UNPACK_BIGNUM(objPtr, *bignumValue); objPtr->internalRep.ptrAndLongRep.ptr = NULL; objPtr->internalRep.ptrAndLongRep.value = 0; @@ -2841,7 +2832,7 @@ Tcl_GetBignumFromObj( /* *---------------------------------------------------------------------- * - * Tcl_GetBignumAndClearObj -- + * Tcl_TakeBignumFromObj -- * * This function retrieves a 'bignum' value from a Tcl object, converting * the object if necessary. @@ -2865,7 +2856,7 @@ Tcl_GetBignumFromObj( */ int -Tcl_GetBignumAndClearObj( +Tcl_TakeBignumFromObj( Tcl_Interp *interp, /* Tcl interpreter for error reporting */ Tcl_Obj *objPtr, /* Object to read */ mp_int *bignumValue) /* Returned bignum value. */ |