else
{
if (cond_string != nullptr)
- cond_string_copy.reset (xstrdup (cond_string));
+ cond_string_copy = make_unique_xstrdup (cond_string);
if (extra_string != nullptr)
- extra_string_copy.reset (xstrdup (extra_string));
+ extra_string_copy = make_unique_xstrdup (extra_string);
}
/* Clear these. Updated values are now held in the *_copy locals. */
const char *comp_dir_, enum language language_,
CORE_ADDR last_addr, struct compunit_symtab *cust)
: m_objfile (objfile_),
- m_last_source_file (name == nullptr ? nullptr : xstrdup (name)),
+ m_last_source_file (name == nullptr ? nullptr : make_unique_xstrdup (name)),
m_comp_dir (comp_dir_ == nullptr ? "" : comp_dir_),
m_compunit_symtab (cust),
m_language (language_),
void set_last_source_file (const char *name)
{
- char *new_name = name == NULL ? NULL : xstrdup (name);
- m_last_source_file.reset (new_name);
+ if (name == nullptr)
+ m_last_source_file = nullptr;
+ else
+ m_last_source_file = make_unique_xstrdup (name);
}
const char *get_last_source_file ()
{
if (defname == NULL)
error (_("Missing filename."));
- filename.reset (xstrdup (defname));
+ filename = make_unique_xstrdup (defname);
}
else
{
if (args != NULL)
run = xstrprintf ("%s %s", cmd, args);
else
- run.reset (xstrdup (cmd));
+ run = make_unique_xstrdup (cmd);
execute_command ( /*ui */ run.get (), 0 /*from_tty */ );
}
}
/* Duplicate the symbol name, so the caller has consistency
in garbage collection. */
- name->reset (xstrdup ((*sym)->print_name ()));
+ *name = make_unique_xstrdup ((*sym)->print_name ());
/* If a symbol is specified attempt to determine the language
from the symbol. If mode is not "auto", then the language
}
}
if (! docstring)
- docstring.reset (xstrdup (_("This function is not documented.")));
+ docstring = make_unique_xstrdup (_("This function is not documented."));
add_internal_function (make_unique_xstrdup (name), std::move (docstring),
fnpy_call, self_ref.release ());
*addr = lazy->address;
*str_elt_type = stpy_lazy_string_elt_type (lazy);
*length = lazy->length;
- encoding->reset (lazy->encoding ? xstrdup (lazy->encoding) : NULL);
+ if (lazy->encoding == nullptr)
+ *encoding = nullptr;
+ else
+ *encoding = make_unique_xstrdup (lazy->encoding);
}
/* __str__ for LazyString. */
|| (doc_type != doc_string_description && *result == '\0'))
{
if (doc_type == doc_string_description)
- result.reset (xstrdup (_("This command is not documented.")));
+ result = make_unique_xstrdup (_("This command is not documented."));
else
{
if (doc_type == doc_string_show)
*/
if (!IS_TARGET_ABSOLUTE_PATH (fskind, in_pathname) || sysroot == NULL)
- temp_pathname.reset (xstrdup (in_pathname));
+ temp_pathname = make_unique_xstrdup (in_pathname);
else
{
bool need_dir_separator;
filename. Not much more we can do...) */
if (!source_full_path_of (in_pathname, &result))
- result.reset (xstrdup (in_pathname));
+ result = make_unique_xstrdup (in_pathname);
if (fd != NULL)
*fd = -1;
}
should report the pathname where GDB tried to find the file. */
if (dirname == nullptr || IS_ABSOLUTE_PATH (filename))
- fullname.reset (xstrdup (filename));
+ fullname = make_unique_xstrdup (filename);
else
fullname.reset (concat (dirname, SLASH_STRING,
filename, (char *) nullptr));
if (s->compunit ()->dirname () == nullptr
|| IS_ABSOLUTE_PATH (s->filename ()))
- fullname.reset (xstrdup (s->filename ()));
+ fullname = make_unique_xstrdup (s->filename ());
else
fullname.reset (concat (s->compunit ()->dirname (), SLASH_STRING,
s->filename (), (char *) NULL));
}
catch (const gdb_exception_error &except)
{
- argp->error.reset (xstrdup (except.what ()));
+ argp->error = make_unique_xstrdup (except.what ());
}
}
argp->sym = sym;
argp->val = val;
- argp->error.reset (val_error ? xstrdup (val_error) : NULL);
+ if (val_error == nullptr)
+ argp->error = nullptr;
+ else
+ argp->error = make_unique_xstrdup (val_error);
if (!val && !val_error)
argp->entry_kind = print_entry_values_only;
else if ((fp_opts.print_entry_values == print_entry_values_compact
entryargp->sym = sym;
entryargp->val = entryval;
- entryargp->error.reset (entryval_error ? xstrdup (entryval_error) : NULL);
+ if (entryval_error == nullptr)
+ entryargp->error = nullptr;
+ else
+ entryargp->error = make_unique_xstrdup (entryval_error);
if (!entryval && !entryval_error)
entryargp->entry_kind = print_entry_values_no;
else
/* If we didn't hit the C++ case above, set *funname
here. */
if (funname == NULL)
- funname.reset (xstrdup (print_name));
+ funname = make_unique_xstrdup (print_name);
}
else
{
bound_minimal_symbol msymbol = lookup_minimal_symbol_by_pc (pc);
if (msymbol.minsym != NULL)
{
- funname.reset (xstrdup (msymbol.minsym->print_name ()));
+ funname = make_unique_xstrdup (msymbol.minsym->print_name ());
*funlang = msymbol.minsym->language ();
}
}
#FIELD)); \
\
if (strlen (p) > 0) \
- (VAR)->FIELD.reset (xstrdup (p)); \
+ (VAR)->FIELD = make_unique_xstrdup (p); \
else \
- (VAR)->FIELD = NULL; \
+ (VAR)->FIELD = nullptr; \
} \
while (0)