#include "value.h"
#include "symfile.h"
#include "objfiles.h"
-#include "string.h" /* for strchr */
+#include "gdb_string.h" /* for strchr */
#include "target.h" /* for target_has_execution */
#include "gdbcore.h"
#include "gdbcmd.h"
while (*cp && *cp == '_')
cp++; /* skip any initial underbars in class name */
- if (!(cp = strchr(cp, '_'))) /* find first non-initial underbar */
+ cp = strchr(cp, '_');
+ if (!cp) /* find first non-initial underbar */
{
- free(demangled); /* not mangled name */
+ xfree(demangled); /* not mangled name */
return NULL;
}
if (cp[1] == '_') { /* easy case: no category name */
}
else {
*cp++ = '('; /* less easy case: category name */
- if (!(cp = strchr(cp, '_')))
+ cp = strchr(cp, '_');
+ if (!cp)
{
- free(demangled); /* not mangled name */
+ xfree(demangled); /* not mangled name */
return NULL;
}
*cp++ = ')';
s = (char *)xmalloc(len);
strcpy(s, msglist_sel);
strncat(s, p, plen);
- free(msglist_sel);
+ xfree(msglist_sel);
msglist_sel = s;
if (addcolon) {
s[len-2] = ':';
if (!selid)
error("Can't find selector \"%s\"", p);
write_exp_elt_longcst (selid);
- free(p);
+ xfree(p);
write_exp_elt_longcst (val); /* Number of args */
- free(sel);
+ xfree(sel);
return val;
}
{
char *aname, *bname;
- if ((aname = SYMBOL_SOURCE_NAME (*(struct symbol **) a)) == NULL ||
- (bname = SYMBOL_SOURCE_NAME (*(struct symbol **) b)) == NULL)
+ aname = SYMBOL_SOURCE_NAME (*(struct symbol **) a);
+ bname = SYMBOL_SOURCE_NAME (*(struct symbol **) b);
+ if (aname == NULL || bname == NULL)
error ("internal: compare_selectors(1)");
- if ((aname = strchr(aname, ' ')) == NULL ||
- (bname = strchr(bname, ' ')) == NULL)
+ aname = strchr(aname, ' ');
+ bname = strchr(bname, ' ');
+ if (aname == NULL || bname == NULL)
error ("internal: compare_selectors(2)");
return specialcmp (aname+1, bname+1);
ALL_MSYMBOLS (objfile, msymbol)
{
QUIT;
- if ((name = SYMBOL_DEMANGLED_NAME (msymbol)) == NULL)
+ name = SYMBOL_DEMANGLED_NAME (msymbol);
+ if (name == NULL)
name = SYMBOL_NAME (msymbol);
if (name &&
(name[0] == '-' || name[0] == '+') &&
ALL_MSYMBOLS (objfile, msymbol)
{
QUIT;
- if ((name = SYMBOL_DEMANGLED_NAME (msymbol)) == NULL)
+ name = SYMBOL_DEMANGLED_NAME (msymbol);
+ if (name == NULL)
name = SYMBOL_NAME (msymbol);
if (name &&
(name[0] == '-' || name[0] == '+') &&
char *p = asel;
QUIT;
- if ((name = SYMBOL_DEMANGLED_NAME (sym_arr[ix])) == NULL)
+ name = SYMBOL_DEMANGLED_NAME (sym_arr[ix]);
+ if (name == NULL)
name = SYMBOL_NAME (sym_arr[ix]);
name = strchr (name, ' ') + 1;
if (p[0] && specialcmp(name, p) == 0)
{
char *aname, *bname;
- if ((aname = SYMBOL_SOURCE_NAME (*(struct symbol **) a)) == NULL ||
- (bname = SYMBOL_SOURCE_NAME (*(struct symbol **) b)) == NULL)
+ aname = SYMBOL_SOURCE_NAME (*(struct symbol **) a);
+ bname = SYMBOL_SOURCE_NAME (*(struct symbol **) b);
+ if (aname == NULL || bname == NULL)
error ("internal: compare_classes(1)");
return specialcmp (aname+1, bname+1);
ALL_MSYMBOLS (objfile, msymbol)
{
QUIT;
- if ((name = SYMBOL_DEMANGLED_NAME (msymbol)) == NULL)
+ name = SYMBOL_DEMANGLED_NAME (msymbol);
+ if (name == NULL)
name = SYMBOL_NAME (msymbol);
if (name &&
(name[0] == '-' || name[0] == '+') &&
ALL_MSYMBOLS (objfile, msymbol)
{
QUIT;
- if ((name = SYMBOL_DEMANGLED_NAME (msymbol)) == NULL)
+ name = SYMBOL_DEMANGLED_NAME (msymbol);
+ if (name == NULL)
name = SYMBOL_NAME (msymbol);
if (name &&
(name[0] == '-' || name[0] == '+') &&
char *p = aclass;
QUIT;
- if ((name = SYMBOL_DEMANGLED_NAME (sym_arr[ix])) == NULL)
+ name = SYMBOL_DEMANGLED_NAME (sym_arr[ix]);
+ if (name == NULL)
name = SYMBOL_NAME (sym_arr[ix]);
name += 2;
if (p[0] && specialcmp(name, p) == 0)
do_cleanups (old_chain);
}
- if (!(function = find_function_in_inferior ("_NSPrintForDebugger")))
+ function = find_function_in_inferior ("_NSPrintForDebugger");
+ if (!function)
error ("Unable to locate _NSPrintForDebugger in child process");
description = call_function_by_hand (function, 1, &object);
- if ((string_addr = value_as_long (description)) == 0)
+ string_addr = value_as_long (description);
+ if (string_addr == 0)
error ("object returns null description");
read_memory (string_addr + i++, &c, 1);
};
int
-find_objc_msgcall_submethod_helper (PTR arg)
+find_objc_msgcall_submethod_helper (void * arg)
{
struct objc_submethod_helper_data *s =
(struct objc_submethod_helper_data *) arg;
s.new_pc = new_pc;
if (catch_errors (find_objc_msgcall_submethod_helper,
- (PTR) &s,
+ (void *) &s,
"Unable to determine target of Objective-C method call (ignoring):\n",
RETURN_MASK_ALL) == 0)
return 1;