Morten Brørup, Dec 16, 2022 at 11:47:
> > +   usage_str[0] = '\0';
> > +   usage_cb = lcore_usage_cb;
> > +   if (usage_cb != NULL && usage_cb(lcore_id, &usage) == 0) {
>
> Move memset() inside here, and add comment:
>
> + /* The application's callback may not set all the fields in the structure, 
> so clear it here. */
> + memset(&usage, 0, sizeof(usage));

This may make the code more complex than it needs to be (two nested ifs)
for very little performance benefit. I'm not sure it is worth it. I can
add the comment, though.

Reply via email to