From: Roland Schwingel <roland@onevision.com>
To: insight@sourceware.org
Subject: [PATCH] Remove deprecated access to tcl internal variables
Date: Mon, 19 Mar 2012 11:46:00 -0000 [thread overview]
Message-ID: <4F671C73.2020308@onevision.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 688 bytes --]
Hi...
Since tcl 8.6 access to some internal variables has been removed from
the code. It was already deprecated since many years. Attached you find
2 patches replacing the deprecated stuff with the current official way.
This is also backward compatible to insight's tcl 8.4 version checkin in
to sourceware.org.
Changelog:
2012-03-19 Roland Schwingel <roland.schwingel@onevision.com>
* generic/gdbtk.c: (gdbtk_init,tk_command): Replace deprecated
access
to tcl interpreter result string with Tcl_GetStringResult().
* generic/gdbtk-hooks.c (gdbtk_read,gdbtk_readline,gdbtk_load_hash)
(gdbtk_query): Likewise
Any comments? Is this ok?
Roland
[-- Attachment #2: tcl_compat_gdbtk.c.patch --]
[-- Type: text/plain, Size: 1580 bytes --]
--- gdbtk_orig/generic/gdbtk.c 2012-03-19 11:21:15.542232400 +0100
+++ gdbtk/generic/gdbtk.c 2012-03-19 11:23:12.099170600 +0100
@@ -494,17 +494,17 @@
make_final_cleanup (gdbtk_cleanup, NULL);
if (Tcl_Init (gdbtk_interp) != TCL_OK)
- error ("Tcl_Init failed: %s", gdbtk_interp->result);
+ error ("Tcl_Init failed: %s", Tcl_GetStringResult(gdbtk_interp));
/* Initialize the Paths variable. */
if (ide_initialize_paths (gdbtk_interp, "") != TCL_OK)
- error ("ide_initialize_paths failed: %s", gdbtk_interp->result);
+ error ("ide_initialize_paths failed: %s", Tcl_GetStringResult(gdbtk_interp));
if (Tk_Init (gdbtk_interp) != TCL_OK)
- error ("Tk_Init failed: %s", gdbtk_interp->result);
+ error ("Tk_Init failed: %s", Tcl_GetStringResult(gdbtk_interp));
if (Tktable_Init (gdbtk_interp) != TCL_OK)
- error ("Tktable_Init failed: %s", gdbtk_interp->result);
+ error ("Tktable_Init failed: %s", Tcl_GetStringResult(gdbtk_interp));
Tcl_StaticPackage (gdbtk_interp, "Tktable", Tktable_Init,
(Tcl_PackageInitProc *) NULL);
@@ -560,7 +560,7 @@
if (Gdbtk_Init (gdbtk_interp) != TCL_OK)
{
- error ("Gdbtk_Init failed: %s", gdbtk_interp->result);
+ error ("Gdbtk_Init failed: %s", Tcl_GetStringResult(gdbtk_interp));
}
Tcl_StaticPackage (gdbtk_interp, "Insight", Gdbtk_Init, NULL);
@@ -740,7 +740,7 @@
retval = Tcl_Eval (gdbtk_interp, cmd);
- result = xstrdup (gdbtk_interp->result);
+ result = xstrdup (Tcl_GetStringResult(gdbtk_interp));
old_chain = make_cleanup (free, result);
[-- Attachment #3: tcl_compat_gdbtk-hooks.c.patch --]
[-- Type: text/plain, Size: 1494 bytes --]
--- gdbtk_orig/generic/gdbtk-hooks.c 2012-01-03 13:26:56.000000000 +0100
+++ gdbtk/generic/gdbtk-hooks.c 2012-03-05 11:47:03.340565000 +0100
@@ -254,17 +254,22 @@
{
report_error ();
actual_len = 0;
+ buf[0] = '\0';
+ return 0;
}
else
- actual_len = strlen (gdbtk_interp->result);
+ {
+ const char *tclResult = Tcl_GetStringResult(gdbtk_interp);
+ actual_len = strlen (tclResult);
/* Truncate the string if it is too big for the caller's buffer. */
if (actual_len >= sizeof_buf)
actual_len = sizeof_buf - 1;
- memcpy (buf, gdbtk_interp->result, actual_len);
+ memcpy (buf,tclResult, actual_len);
buf[actual_len] = '\0';
return actual_len;
+ }
}
else
{
@@ -507,11 +512,11 @@
if (result == TCL_OK)
{
- return (xstrdup (gdbtk_interp->result));
+ return (xstrdup (Tcl_GetStringResult(gdbtk_interp)));
}
else
{
- gdbtk_fputs (gdbtk_interp->result, gdb_stdout);
+ gdbtk_fputs (Tcl_GetStringResult(gdbtk_interp), gdb_stdout);
gdbtk_fputs ("\n", gdb_stdout);
return (NULL);
}
@@ -635,7 +640,7 @@
report_error ();
free(buf);
- return atoi (gdbtk_interp->result);
+ return atoi (Tcl_GetStringResult(gdbtk_interp));
}
@@ -689,7 +694,7 @@
gdbtk_two_elem_cmd ("gdbtk_tcl_query", buf);
free(buf);
- val = atol (gdbtk_interp->result);
+ val = atol (Tcl_GetStringResult(gdbtk_interp));
return val;
}
next reply other threads:[~2012-03-19 11:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-19 11:46 Roland Schwingel [this message]
2012-03-23 22:25 ` Keith Seitz
2012-03-27 7:13 Roland Schwingel
2012-03-27 15:18 ` Keith Seitz
2012-03-28 14:53 Roland Schwingel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F671C73.2020308@onevision.com \
--to=roland@onevision.com \
--cc=insight@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).