On 10/11/22 03:46, Paolo Bonzini wrote:
{
+ QOSStackElement *elem = g_new0(QOSStackElement, 1);
int len = 0; /* root is not counted */
- if (qos_node_tos == QOS_PATH_MAX_ELEMENT_SIZE) {
- g_printerr("QOSStack: full stack, cannot push");
- abort();
- }
-
if (parent) {
len = parent->length + 1;
}
- qos_node_stack[qos_node_tos++] = (QOSStackElement) {
+ *elem = (QOSStackElement) {
.node = el,
.parent = parent,
.parent_edge = e,
.length = len,
};
-}
If you're going to completely initialize the structure via assignment, you don't need to
zero the storage first. I suggest either g_new + structure assignment or g_new0 +
sequence of element assignments.
Otherwise,
Reviewed-by: Richard Henderson <[email protected]>
r~