Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions cmpInt.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Tcl_FetchInternalRep(Tcl_Obj *objPtr, const Tcl_ObjType *type) {
(Tcl_ObjInternalRep *)(&objPtr->internalRep)
: NULL;
}

static inline void
Tcl_FreeInternalRep(Tcl_Obj *objPtr) {
if (objPtr->typePtr != NULL) {
Expand All @@ -71,6 +72,19 @@ Tcl_FreeInternalRep(Tcl_Obj *objPtr) {
objPtr->typePtr = NULL;
}
}

static inline void
Tcl_StoreInternalRep(Tcl_Obj *objPtr, const Tcl_ObjType *typePtr,
const Tcl_ObjInternalRep *irPtr) {
Tcl_FreeInternalRep(objPtr);
/* When irPtr == NULL, just leave objPtr with no internalrep for typePtr */
if (irPtr) {
objPtr->internalRep.twoPtrValue.ptr1 = irPtr->twoPtrValue.ptr1;
objPtr->internalRep.twoPtrValue.ptr2 = irPtr->twoPtrValue.ptr2;
objPtr->typePtr = typePtr;
}
}

#endif /* TCL_MAJOR_VERSION < 8 */

/*
Expand Down
8 changes: 4 additions & 4 deletions cmpRPkg.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ static char procCommand[] = CMP_PROC_COMMAND; /* "bcproc" */
typedef struct CmdTable
{
const char* cmdName; /* unqualified, e.g. "bceval" */
Tcl_ObjCmdProc2* proc; /* implementation */
Tcl_ObjCmdProc* proc; /* implementation */
int exportIt; /* nonzero => export */
} CmdTable;

Expand Down Expand Up @@ -62,7 +62,7 @@ static int RegisterCommand(Tcl_Interp* interp, const char* nsName, const CmdTabl
Tcl_DStringAppend(&fq, "::", 2);
Tcl_DStringAppend(&fq, cmd->cmdName, -1);

Tcl_CreateObjCommand2(interp, Tcl_DStringValue(&fq), cmd->proc, NULL, NULL);
Tcl_CreateObjCommand(interp, Tcl_DStringValue(&fq), cmd->proc, NULL, NULL);
Tcl_DStringFree(&fq);

if (cmd->exportIt)
Expand All @@ -89,12 +89,12 @@ int Tbcload_SafeInit(Tcl_Interp* interp)
static int TbcloadInitInternal(Tcl_Interp* interp, int isSafe)
{
#ifdef USE_TCL_STUBS
if (!Tcl_InitStubs(interp, "9.0", 1))
if (!Tcl_InitStubs(interp, TCL_VERSION, 1))
{
return TCL_ERROR;
}
#else
if (Tcl_PkgRequire(interp, "Tcl", "9.0", 1) == NULL)
if (Tcl_PkgRequire(interp, "Tcl", TCL_VERSION, 1) == NULL)
{
return TCL_ERROR;
}
Expand Down
16 changes: 8 additions & 8 deletions cmpRead.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ static void InitTypes();
*----------------------------------------------------------------------
*/

int Tbcload_EvalObjCmd(void* dummy, Tcl_Interp* interp, Tcl_Size objc, Tcl_Obj* const objv[])
int Tbcload_EvalObjCmd(void* dummy, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
{
ImageSignature sig;
Tcl_Obj* cmdObjPtr;
Expand Down Expand Up @@ -434,7 +434,7 @@ int Tbcload_EvalObjCmd(void* dummy, Tcl_Interp* interp, Tcl_Size objc, Tcl_Obj*
*----------------------------------------------------------------------
*/

int Tbcload_ProcObjCmd(void* dummy, Tcl_Interp* interp, Tcl_Size objc, Tcl_Obj* const objv[])
int Tbcload_ProcObjCmd(void* dummy, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
{
return (*bcprocCmdProc)(dummy, interp, objc, objv);
}
Expand Down Expand Up @@ -1933,10 +1933,10 @@ static Tcl_Obj* ExtractCompiledFile(Tcl_Interp* interp, char* codePtr, Tcl_Size
InitExtractEnv(newCodePtr, (codePtr + codeLength), &exEnv);

/*
* Do not allow loading newer bytecodes into older interps
* Do not allow loading bytecodes across major versions or into older versions.
*/
if ((exEnv.sig.tclMajorVersion > tclMajorVersion) ||
((exEnv.sig.tclMajorVersion == tclMajorVersion) && (exEnv.sig.tclMinorVersion > tclMinorVersion)))
if ((exEnv.sig.tclMajorVersion != tclMajorVersion) ||
(exEnv.sig.tclMinorVersion > tclMinorVersion))
{
char buf[128];

Expand Down Expand Up @@ -2212,7 +2212,7 @@ static int InitCompatibilityLayer(Tcl_Interp* interp)

int TbcloadInit(Tcl_Interp* interp)
{
if (!Tcl_InitStubs(interp, "9.0", 1))
if (!Tcl_InitStubs(interp, TCL_VERSION, 1))
{
return TCL_ERROR;
}
Expand Down Expand Up @@ -2299,8 +2299,8 @@ static int ExtractJumptableInfo(Tcl_Interp* interp, ExtractionEnv* envPtr, AuxDa
goto errorReturn;
}
hEntry = Tcl_CreateHashEntry(&infoPtr->hashTable, key, &new);
Tcl_Free(key);
Tcl_SetHashValue(hEntry, (char*)value);
Tcl_Free((char *)key);
Tcl_SetHashValue(hEntry, (char*)(intptr_t)value);
}

/*
Expand Down
4 changes: 2 additions & 2 deletions proTbcLoad.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
*----------------------------------------------------------------
*/

EXTERN int Tbcload_EvalObjCmd(void* dummy, Tcl_Interp* interp, Tcl_Size objc, Tcl_Obj* const objv[]);
EXTERN int Tbcload_ProcObjCmd(void* dummy, Tcl_Interp* interp, Tcl_Size objc, Tcl_Obj* const objv[]);
EXTERN Tcl_ObjCmdProc Tbcload_EvalObjCmd;
EXTERN Tcl_ObjCmdProc Tbcload_ProcObjCmd;
EXTERN const char* TbcloadGetPackageName(void);

EXTERN int Tbcload_Init(Tcl_Interp* interp);
Expand Down
Loading