From fb81bb7d6255f5040661d59559edf32bc997bd6d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 26 Feb 2013 12:18:40 +0000 Subject: Remove unneeded SetOptionFromAny and SetTextIndexFromAny. They were only needed to prevent a panic in Tcl, but Tcl now generates a nice error-message in stead of panicing. --- generic/tkConfig.c | 35 +---------------------------------- generic/tkTextIndex.c | 16 +--------------- 2 files changed, 2 insertions(+), 49 deletions(-) diff --git a/generic/tkConfig.c b/generic/tkConfig.c index 3be882f..e06d5d5 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -128,7 +128,6 @@ static Option * GetOptionFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, OptionTable *tablePtr); static int ObjectIsEmpty(Tcl_Obj *objPtr); static void FreeOptionInternalRep(Tcl_Obj *objPtr); -static int SetOptionFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); /* * The structure below defines an object type that is used to cache the result @@ -142,7 +141,7 @@ static const Tcl_ObjType optionObjType = { FreeOptionInternalRep, /* freeIntRepProc */ NULL, /* dupIntRepProc */ NULL, /* updateStringProc */ - SetOptionFromAny /* setFromAnyProc */ + NULL /* setFromAnyProc */ }; /* @@ -1204,38 +1203,6 @@ TkGetOptionSpec( /* *---------------------------------------------------------------------- * - * SetOptionFromAny -- - * - * This function is called to convert a Tcl object to option internal - * form. However, this doesn't make sense (need to have a table of - * options in order to do the conversion) so the function always - * generates an error. - * - * Results: - * The return value is always TCL_ERROR, and an error message is left in - * interp's result if interp isn't NULL. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -static int -SetOptionFromAny( - Tcl_Interp *interp, /* Used for error reporting if not NULL. */ - register Tcl_Obj *objPtr) /* The object to convert. */ -{ - Tcl_SetObjResult(interp, Tcl_NewStringObj( - "can't convert value to option except via GetOptionFromObj API", - -1)); - Tcl_SetErrorCode(interp, "TK", "API_ABUSE", NULL); - return TCL_ERROR; -} - -/* - *---------------------------------------------------------------------- - * * FreeOptionInternalRep -- * * Part of the option Tcl object type implementation. Frees the storage diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c index fc97412..55a4907 100644 --- a/generic/tkTextIndex.c +++ b/generic/tkTextIndex.c @@ -48,8 +48,6 @@ static int GetIndex(Tcl_Interp *interp, TkSharedText *sharedPtr, static void DupTextIndexInternalRep(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr); static void FreeTextIndexInternalRep(Tcl_Obj *listPtr); -static int SetTextIndexFromAny(Tcl_Interp *interp, - Tcl_Obj *objPtr); static void UpdateStringOfTextIndex(Tcl_Obj *objPtr); /* @@ -75,7 +73,7 @@ const Tcl_ObjType tkTextIndexType = { FreeTextIndexInternalRep, /* freeIntRepProc */ DupTextIndexInternalRep, /* dupIntRepProc */ NULL, /* updateStringProc */ - SetTextIndexFromAny /* setFromAnyProc */ + NULL /* setFromAnyProc */ }; static void @@ -142,18 +140,6 @@ UpdateStringOfTextIndex( strcpy(objPtr->bytes, buffer); objPtr->length = len; } - -static int -SetTextIndexFromAny( - Tcl_Interp *interp, /* Used for error reporting if not NULL. */ - Tcl_Obj *objPtr) /* The object to convert. */ -{ - Tcl_SetObjResult(interp, Tcl_NewStringObj( - "can't convert value to textindex except via" - " TkTextGetIndexFromObj API", -1)); - Tcl_SetErrorCode(interp, "TK", "API_ABUSE", NULL); - return TCL_ERROR; -} /* *--------------------------------------------------------------------------- -- cgit v0.12