Mark the AddressSpace structure const when it is only accessed read-only.
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
---
include/system/memory.h | 2 +-
system/memory.c | 6 +++---
system/physmem.c | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/system/memory.h b/include/system/memory.h
index 38e4f7b25e5..4c013593cae 100644
--- a/include/system/memory.h
+++ b/include/system/memory.h
@@ -2682,7 +2682,7 @@ void address_space_destroy_free(AddressSpace *as);
*
* @as: an initialized #AddressSpace
*/
-void address_space_remove_listeners(AddressSpace *as);
+void address_space_remove_listeners(const AddressSpace *as);
/**
* address_space_rw: read from or write to an address space.
diff --git a/system/memory.c b/system/memory.c
index 87ebeb93458..40e17ed22c6 100644
--- a/system/memory.c
+++ b/system/memory.c
@@ -2978,7 +2978,7 @@ void memory_global_dirty_log_stop(unsigned int flags)
}
static void listener_add_address_space(MemoryListener *listener,
- AddressSpace *as)
+ const AddressSpace *as)
{
unsigned i;
FlatView *view;
@@ -3043,7 +3043,7 @@ static void listener_add_address_space(MemoryListener
*listener,
}
static void listener_del_address_space(MemoryListener *listener,
- AddressSpace *as)
+ const AddressSpace *as)
{
unsigned i;
FlatView *view;
@@ -3148,7 +3148,7 @@ void memory_listener_unregister(MemoryListener *listener)
listener->address_space = NULL;
}
-void address_space_remove_listeners(AddressSpace *as)
+void address_space_remove_listeners(const AddressSpace *as)
{
while (!QTAILQ_EMPTY(&as->listeners)) {
memory_listener_unregister(QTAILQ_FIRST(&as->listeners));
diff --git a/system/physmem.c b/system/physmem.c
index bbcbcedda15..c00f75bf591 100644
--- a/system/physmem.c
+++ b/system/physmem.c
@@ -3573,7 +3573,7 @@
address_space_unregister_map_client_do(AddressSpaceMapClient *client)
g_free(client);
}
-static void address_space_notify_map_clients_locked(AddressSpace *as)
+static void address_space_notify_map_clients_locked(const AddressSpace *as)
{
AddressSpaceMapClient *client;
--
2.53.0