[Spice-commits] server/stat-file.c
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Aug 22 07:53:49 UTC 2019
server/stat-file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 80bb7eb774ad5a7ae95d7b395841d4c79908be3d
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Thu Aug 15 13:31:58 2019 +0100
stat-file: Use proper macro for container computation
This is currently more style patch as the "value" field is the
first field of SpiceStatNode structure, so has offset 0. However
to compute the containing structure it better to use the proper
macro to avoid confusion.
If the offset won't be 0 the subtraction would compute the
wrong pointer as the offset is expressed in bytes but the
element size are uint64_t.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Victor Toso <victortoso at redhat.com>
diff --git a/server/stat-file.c b/server/stat-file.c
index 4228be31..38c39338 100644
--- a/server/stat-file.c
+++ b/server/stat-file.c
@@ -233,6 +233,6 @@ void stat_file_remove_node(RedStatFile *stat_file, StatNodeRef ref)
void stat_file_remove_counter(RedStatFile *stat_file, uint64_t *counter)
{
- stat_file_remove(stat_file, (SpiceStatNode *)(counter - SPICE_OFFSETOF(SpiceStatNode, value)));
+ stat_file_remove(stat_file, SPICE_CONTAINEROF(counter, SpiceStatNode, value));
}
#endif
More information about the Spice-commits
mailing list