bmx-routing / bmx7

BMX7 / SEMTOR Securely Entrusted Mesh Routing Protocol
GNU General Public License v2.0
63 stars 15 forks source link

Useless if (currSqn == 0) { check #29

Closed aparcar closed 6 years ago

aparcar commented 6 years ago

https://github.com/bmx-routing/bmx7/blob/3df0a26e3247361097c9207a4c248f40bf7bfe0f/bmx.c#L1430 https://github.com/bmx-routing/bmx7/blob/3df0a26e3247361097c9207a4c248f40bf7bfe0f/bmx.c#L1449

Isn't currSqn set to zero just before and so this if doesn't do anything but always equal true?

axn commented 6 years ago

No, if a variable in c is declared static it is initialized only once and keeps its last (re-)assignement till program termination.

aparcar commented 6 years ago

Thanks for the clarification!