to stat it. If it's not found, then ask gdb to find it for us. */
if (IS_ABSOLUTE_PATH (filename))
{
- struct stat st;
- const int status = stat (filename, &st);
+ struct stat sbuf;
+ const int status = stat (filename, &sbuf);
if (status == 0)
{
- if (S_ISREG (st.st_mode))
+ if (S_ISREG (sbuf.st_mode))
fullname = filename;
}
}
{
case VAROBJ_IN_SCOPE:
{
- Tcl_Obj *var
- = Tcl_NewStringObj (varobj_get_objname (r->varobj), -1);
- Tcl_ListObjAppendElement (NULL, changed, var);
+ Tcl_Obj *v = Tcl_NewStringObj (varobj_get_objname (r->varobj), -1);
+ Tcl_ListObjAppendElement (NULL, changed, v);
}
break;
/* This variable holds the name of a Tcl file which should be sourced by the
interpreter when it goes idle at startup. Used with the testsuite. */
-static char *gdbtk_source_filename = NULL;
+static std::string gdbtk_source_filename;
bool gdbtk_disable_write = true;
\f
/* Now source in the filename provided by the --tclcommand option.
This is mostly used for the gdbtk testsuite... */
- if (gdbtk_source_filename != NULL)
+ if (gdbtk_source_filename.length ())
{
- const char *s = "after idle source ";
- char *script = concat (s, gdbtk_source_filename, (char *) NULL);
- Tcl_Eval (gdbtk_tcl_interp, script);
- free (gdbtk_source_filename);
- free (script);
+ Tcl_Eval (gdbtk_tcl_interp,
+ ("after idle source " + gdbtk_source_filename).c_str ());
+ gdbtk_source_filename.clear ();
}
}
{
if (access (filename, R_OK) != 0)
return 0;
- else
- gdbtk_source_filename = xstrdup (filename);
+ gdbtk_source_filename = filename;
return 1;
}