aboutsummaryrefslogtreecommitdiff
path: root/proc.c
diff options
context:
space:
mode:
authorPetr Machata <pmachata@redhat.com>2013-03-08 22:11:36 +0100
committerPetr Machata <pmachata@redhat.com>2013-03-08 22:52:32 +0100
commit98ff309cdc98857eb30992f108439cb7d7673598 (patch)
tree1686496538844debf186b8631323dc686dd2718f /proc.c
parentb658d4f2204c596f54813cdb80d668bb4656d598 (diff)
downloadltrace-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.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/proc.c b/proc.c
index ea44e29..ffc2029 100644
--- a/proc.c
+++ b/proc.c
@@ -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: