Page MenuHomeFreeBSD

Initialize some local variables earlier
ClosedPublic

Authored by mhorne on Sep 16 2020, 4:31 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Mar 7, 10:57 AM
Unknown Object (File)
Dec 20 2023, 6:34 AM
Unknown Object (File)
Dec 18 2023, 3:19 AM
Unknown Object (File)
Sep 23 2023, 12:25 AM
Unknown Object (File)
Sep 5 2023, 10:15 PM
Unknown Object (File)
Sep 3 2023, 7:50 PM
Unknown Object (File)
Aug 3 2023, 12:50 AM
Unknown Object (File)
Jun 30 2023, 9:43 PM

Details

Summary

Move the initialization of these variables to the beginning of their
respective functions.

On our end this creates a small amount of unneeded churn, as these
variables are properly initialized before their first use in all cases.
However, changing this benefits at least one downstream consumer
(NetApp) by allowing local and future modifications to these functions
to be made without worrying about where the initialization occurs.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/netinet/ip_output.c
412 ↗(On Diff #77104)

I'd prefer to retain this line, to ensure ia is still NULL after re-iterating in again:

Address melifaro's comment.

mhorne added inline comments.
sys/netinet/ip_output.c
412 ↗(On Diff #77104)

Thanks, good catch.

This revision is now accepted and ready to land.Sep 18 2020, 7:41 AM
This revision was automatically updated to reflect the committed changes.
mhorne marked an inline comment as done.

The GCC-tagged ones are probably workarounds for GCC 4.2.1 false positives and the initialization likely could just be removed.