Drop useless casts from g_malloc() & friends to pointer

These memory allocation functions return void *, and casting to
another pointer type is useless clutter.  Drop these casts.

If you really want another pointer type, consider g_new().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20220923120025.448759-3-armbru@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
Markus Armbruster 2022-09-23 14:00:24 +02:00 committed by Laurent Vivier
parent 4bb5923605
commit 0a553c12c7
10 changed files with 15 additions and 17 deletions

View file

@ -2262,8 +2262,7 @@ static int kvm_get_supported_feature_msrs(KVMState *s)
}
assert(msr_list.nmsrs > 0);
kvm_feature_msrs = (struct kvm_msr_list *) \
g_malloc0(sizeof(msr_list) +
kvm_feature_msrs = g_malloc0(sizeof(msr_list) +
msr_list.nmsrs * sizeof(msr_list.indices[0]));
kvm_feature_msrs->nmsrs = msr_list.nmsrs;

View file

@ -1164,9 +1164,8 @@ static void whpx_translate_cpu_breakpoints(
(breakpoints->breakpoints ? breakpoints->breakpoints->used : 0);
struct whpx_breakpoint_collection *new_breakpoints =
(struct whpx_breakpoint_collection *)g_malloc0(
sizeof(struct whpx_breakpoint_collection) +
max_breakpoints * sizeof(struct whpx_breakpoint));
g_malloc0(sizeof(struct whpx_breakpoint_collection)
+ max_breakpoints * sizeof(struct whpx_breakpoint));
new_breakpoints->allocated = max_breakpoints;
new_breakpoints->used = 0;