mirror of
https://github.com/weechat/weechat.git
synced 2026-07-07 18:23:13 +02:00
tcl: make plugin compatible with Tcl 9.0
Replace calls to Tcl_GetStringFromObj by Tcl_GetString.
This commit is contained in:
committed by
Sébastien Helleu
parent
ef5ebc19e9
commit
db6b96f629
@@ -39,6 +39,10 @@ Bug fixes::
|
||||
* scripts: fix crash on script unload when a hook is created in a buffer close callback (issue #2067)
|
||||
* trigger: fix memory leak when adding a new trigger with `/trigger` command
|
||||
|
||||
Build::
|
||||
|
||||
* tcl: make plugin compatible with Tcl 9.0 (issue #2075)
|
||||
|
||||
[[v4.2.1]]
|
||||
== Version 4.2.1 (2024-01-22)
|
||||
|
||||
|
||||
+580
-713
File diff suppressed because it is too large
Load Diff
@@ -197,7 +197,7 @@ weechat_tcl_exec (struct t_plugin_script *script,
|
||||
int ret_type, const char *function,
|
||||
const char *format, void **argv)
|
||||
{
|
||||
int argc, i, llength;
|
||||
int argc, i;
|
||||
int *ret_i;
|
||||
char *ret_cv;
|
||||
void *ret_val;
|
||||
@@ -244,18 +244,13 @@ weechat_tcl_exec (struct t_plugin_script *script,
|
||||
}
|
||||
}
|
||||
|
||||
if (Tcl_ListObjLength (interp, cmdlist, &llength) != TCL_OK)
|
||||
llength = 0;
|
||||
|
||||
if (Tcl_EvalObjEx (interp, cmdlist, TCL_EVAL_DIRECT) == TCL_OK)
|
||||
{
|
||||
/* remove elements, decrement their ref count */
|
||||
Tcl_ListObjReplace (interp, cmdlist, 0, llength, 0, NULL);
|
||||
Tcl_DecrRefCount (cmdlist); /* -1 */
|
||||
ret_val = NULL;
|
||||
if (ret_type == WEECHAT_SCRIPT_EXEC_STRING)
|
||||
{
|
||||
ret_cv = Tcl_GetStringFromObj (Tcl_GetObjResult (interp), &i);
|
||||
ret_cv = Tcl_GetString (Tcl_GetObjResult (interp));
|
||||
if (ret_cv)
|
||||
ret_val = (void *)strdup (ret_cv);
|
||||
else
|
||||
@@ -263,7 +258,7 @@ weechat_tcl_exec (struct t_plugin_script *script,
|
||||
}
|
||||
else if (ret_type == WEECHAT_SCRIPT_EXEC_POINTER)
|
||||
{
|
||||
ret_cv = Tcl_GetStringFromObj (Tcl_GetObjResult (interp), &i);
|
||||
ret_cv = Tcl_GetString (Tcl_GetObjResult (interp));
|
||||
if (ret_cv)
|
||||
{
|
||||
ret_val = plugin_script_str2ptr (weechat_tcl_plugin,
|
||||
@@ -306,13 +301,11 @@ weechat_tcl_exec (struct t_plugin_script *script,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* remove elements, decrement their ref count */
|
||||
Tcl_ListObjReplace (interp, cmdlist, 0, llength, 0, NULL);
|
||||
Tcl_DecrRefCount (cmdlist); /* -1 */
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s%s: unable to run function \"%s\": %s"),
|
||||
weechat_prefix ("error"), TCL_PLUGIN_NAME, function,
|
||||
Tcl_GetStringFromObj (Tcl_GetObjResult (interp), &i));
|
||||
Tcl_GetString (Tcl_GetObjResult (interp)));
|
||||
tcl_current_script = old_tcl_script;
|
||||
|
||||
return NULL;
|
||||
@@ -330,7 +323,6 @@ weechat_tcl_exec (struct t_plugin_script *script,
|
||||
struct t_plugin_script *
|
||||
weechat_tcl_load (const char *filename, const char *code)
|
||||
{
|
||||
int i;
|
||||
Tcl_Interp *interp;
|
||||
struct stat buf;
|
||||
|
||||
@@ -373,7 +365,7 @@ weechat_tcl_load (const char *filename, const char *code)
|
||||
weechat_gettext ("%s%s: error occurred while "
|
||||
"parsing file \"%s\": %s"),
|
||||
weechat_prefix ("error"), TCL_PLUGIN_NAME, filename,
|
||||
Tcl_GetStringFromObj (Tcl_GetObjResult (interp), &i));
|
||||
Tcl_GetString (Tcl_GetObjResult (interp)));
|
||||
|
||||
/* if script was registered, remove it from list */
|
||||
if (tcl_current_script)
|
||||
|
||||
Reference in New Issue
Block a user