[OpenWrt-Devel] [PATCH 1/1] use NTP server received via DHCP
Bastian Bittorf
bittorf at bluebottle.com
Fri Jan 15 05:19:55 EST 2016
* Amine Aouled Hamed <amine.ahd at gmail.com> [15.01.2016 10:03]:
> > please make var 'iface' local and while you are there, move
> > all the 'local' declaration to the head of the function.
>
> Wouldn't be better if the local vars inside of the if and for statements
> stay inside?
maybe thats personal preference, i like it outside a loop.
> I mean what is the point of declaring ifaces if I will be using all the
> ifaces? in term of performance(even if it is negligible and clarity of the
> code).
you are right, performance is not an issue here.
i just spotted this in memory if a former double-local-crash-bug
in busybox (which is what happens in a for-loop)
also: declaring iface 'local' means, that it is thrown away
when the functions returns, otherwise it will pollute your
env-space.
bye, bastian
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list