diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2022-04-20 17:18:57 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2022-04-27 22:05:03 -0400 |
commit | bad9471aab31d1b5aa733b8985b8e40e2a97b8e7 (patch) | |
tree | 2306af7ad3d6f4ee2335436b408bc6af593976fe /gdb/addrmap.c | |
parent | 63d609debba854d08a515f73d0ad8e4ef8948370 (diff) | |
download | gdb-bad9471aab31d1b5aa733b8985b8e40e2a97b8e7.zip gdb-bad9471aab31d1b5aa733b8985b8e40e2a97b8e7.tar.gz gdb-bad9471aab31d1b5aa733b8985b8e40e2a97b8e7.tar.bz2 |
gdb: constify addrmap_find
addrmap_find shouldn't need to modify the addrmap, so constify the
addrmap parameter. This helps for the following patch, where getting
the map of a const blockvector will return a const addrmap.
Change-Id: If670e425ed013724a3a77aab7961db50366dccb2
Diffstat (limited to 'gdb/addrmap.c')
-rw-r--r-- | gdb/addrmap.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/gdb/addrmap.c b/gdb/addrmap.c index f888806..8141337 100644 --- a/gdb/addrmap.c +++ b/gdb/addrmap.c @@ -38,7 +38,7 @@ struct addrmap_funcs void (*set_empty) (struct addrmap *self, CORE_ADDR start, CORE_ADDR end_inclusive, void *obj); - void *(*find) (struct addrmap *self, CORE_ADDR addr); + void *(*find) (const addrmap *self, CORE_ADDR addr); struct addrmap *(*create_fixed) (struct addrmap *self, struct obstack *obstack); void (*relocate) (struct addrmap *self, CORE_ADDR offset); @@ -62,7 +62,7 @@ addrmap_set_empty (struct addrmap *map, void * -addrmap_find (struct addrmap *map, CORE_ADDR addr) +addrmap_find (const addrmap *map, CORE_ADDR addr) { return map->funcs->find (map, addr); } @@ -130,11 +130,11 @@ addrmap_fixed_set_empty (struct addrmap *self, static void * -addrmap_fixed_find (struct addrmap *self, CORE_ADDR addr) +addrmap_fixed_find (const addrmap *self, CORE_ADDR addr) { - struct addrmap_fixed *map = (struct addrmap_fixed *) self; - struct addrmap_transition *bottom = &map->transitions[0]; - struct addrmap_transition *top = &map->transitions[map->num_transitions - 1]; + const addrmap_fixed *map = (const addrmap_fixed *) self; + const addrmap_transition *bottom = &map->transitions[0]; + const addrmap_transition *top = &map->transitions[map->num_transitions - 1]; while (bottom < top) { @@ -142,7 +142,7 @@ addrmap_fixed_find (struct addrmap *self, CORE_ADDR addr) 1 (i.e., two entries are under consideration), then mid == bottom, and then we may not narrow the range when (mid->addr < addr). */ - struct addrmap_transition *mid = top - (top - bottom) / 2; + const addrmap_transition *mid = top - (top - bottom) / 2; if (mid->addr == addr) { @@ -389,7 +389,7 @@ addrmap_mutable_set_empty (struct addrmap *self, static void * -addrmap_mutable_find (struct addrmap *self, CORE_ADDR addr) +addrmap_mutable_find (const addrmap *self, CORE_ADDR addr) { struct addrmap_mutable *map = (struct addrmap_mutable *) self; splay_tree_node n = addrmap_splay_tree_lookup (map, addr); |