diff options
author | Pedro Alves <pedro@codesourcery.com> | 2011-02-16 10:13:52 +0000 |
---|---|---|
committer | Pedro Alves <pedro@codesourcery.com> | 2011-02-16 10:13:52 +0000 |
commit | c7c23b0b1c2f82a24bde35a18fe8549b4d5a8101 (patch) | |
tree | f216525f227cdb2313ab574db247aca3d0055097 /gdb/value.c | |
parent | 214ee551673c9b0b6b2c9020f9e86d9011cb4911 (diff) | |
download | gdb-c7c23b0b1c2f82a24bde35a18fe8549b4d5a8101.tar.gz |
* value.c (value_available_contents_eq): Remove redundant local
variables. Fix available contents comparision.
* value.h (value_available_contents_eq): Extend describing
comment.
Diffstat (limited to 'gdb/value.c')
-rw-r--r-- | gdb/value.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/gdb/value.c b/gdb/value.c index 2e07a85cdd1..d2863db1aa2 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -533,21 +533,13 @@ value_available_contents_eq (const struct value *val1, int offset1, const struct value *val2, int offset2, int length) { - int org_len = length; - int org_offset1 = offset1; - int org_offset2 = offset2; int idx1 = 0, idx2 = 0; - int prev_avail; /* This routine is used by printing routines, where we should already have read the value. Note that we only know whether a value chunk is available if we've tried to read it. */ gdb_assert (!val1->lazy && !val2->lazy); - /* The offset from either ORG_OFFSET1 or ORG_OFFSET2 where the - available contents we haven't compared yet start. */ - prev_avail = 0; - while (length > 0) { range_s *r1, *r2; @@ -561,9 +553,9 @@ value_available_contents_eq (const struct value *val1, int offset1, /* The usual case is for both values to be completely available. */ if (idx1 == -1 && idx2 == -1) - return (memcmp (val1->contents + org_offset1 + prev_avail, - val2->contents + org_offset2 + prev_avail, - org_len - prev_avail) == 0); + return (memcmp (val1->contents + offset1, + val2->contents + offset2, + length) == 0); /* The contents only match equal if the available set matches as well. */ else if (idx1 == -1 || idx2 == -1) @@ -596,12 +588,11 @@ value_available_contents_eq (const struct value *val1, int offset1, return 0; /* Compare the _available_ contents. */ - if (memcmp (val1->contents + org_offset1 + prev_avail, - val2->contents + org_offset2 + prev_avail, - l2 - prev_avail) != 0) + if (memcmp (val1->contents + offset1, + val2->contents + offset2, + l1) != 0) return 0; - prev_avail += h1; length -= h1; offset1 += h1; offset2 += h1; |