diff options
author | Petr Machata <pmachata@redhat.com> | 2013-03-08 22:11:36 +0100 |
---|---|---|
committer | Petr Machata <pmachata@redhat.com> | 2013-03-08 22:52:32 +0100 |
commit | 98ff309cdc98857eb30992f108439cb7d7673598 (patch) | |
tree | 1686496538844debf186b8631323dc686dd2718f /proc.c | |
parent | b658d4f2204c596f54813cdb80d668bb4656d598 (diff) | |
download | ltrace-98ff309cdc98857eb30992f108439cb7d7673598.tar.gz |
Change DICT_FIND to DICT_FIND_{REF,VAL}
- In many places, DICT_FIND was awkward to use, as it required the use
of pointers even in cases that the dictionary already stored
pointers. For those cases, add DICT_FIND_VAL.
- Rename the original DICT_FIND to DICT_FIND_REF to make the
disctinction clear. That is useful if the dictionary holds actual
structures.
Diffstat (limited to 'proc.c')
-rw-r--r-- | proc.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -751,9 +751,8 @@ breakpoint_for_symbol(struct library_symbol *libsym, struct process *proc) * be also custom-allocated, and we would really need to swap * the two: delete the one now in the dictionary, swap values * around, and put the new breakpoint back in. */ - struct breakpoint **found = DICT_FIND(proc->breakpoints, - &bp_addr, struct breakpoint *); - if (found != NULL) { + struct breakpoint *bp; + if (DICT_FIND_VAL(proc->breakpoints, &bp_addr, &bp) == 0) { /* MIPS backend makes duplicate requests. This is * likely a bug in the backend. Currently there's no * point assigning more than one symbol to a @@ -767,13 +766,13 @@ breakpoint_for_symbol(struct library_symbol *libsym, struct process *proc) * http://lists.alioth.debian.org/pipermail/ltrace-devel/2012-November/000770.html */ #ifndef __mips__ - assert((*found)->libsym == NULL); - (*found)->libsym = libsym; + assert(bp->libsym == NULL); + bp->libsym = libsym; #endif return 0; } - struct breakpoint *bp = malloc(sizeof(*bp)); + bp = malloc(sizeof(*bp)); if (bp == NULL || breakpoint_init(bp, proc, bp_addr, libsym) < 0) { fail: |