freebsd-src/usr.sbin/rtadvd
Dimitry Andric f28c40aee0 Fix the following -Werror warnings from clang 3.5.0, while building
usr.sbin/rtadvd:

usr.sbin/rtadvd/rtadvd.c:1291:7: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value]
                    abs(preferred_time - pfx->pfx_pltimeexpire) > rai->rai_clockskew) {
                    ^
usr.sbin/rtadvd/rtadvd.c:1291:7: note: remove the call to 'abs' since unsigned values cannot be negative
                    abs(preferred_time - pfx->pfx_pltimeexpire) > rai->rai_clockskew) {
                    ^~~
usr.sbin/rtadvd/rtadvd.c:1324:7: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value]
                    abs(valid_time - pfx->pfx_vltimeexpire) > rai->rai_clockskew) {
                    ^
usr.sbin/rtadvd/rtadvd.c:1324:7: note: remove the call to 'abs' since unsigned values cannot be negative
                    abs(valid_time - pfx->pfx_vltimeexpire) > rai->rai_clockskew) {
                    ^~~
2 errors generated.

These warnings occur because both preferred_time and pfx_pltimeexpire
are uint32_t's, so the subtraction expression is also unsigned, and
calling abs() is a no-op.

However, the intention was to look at the absolute difference between
the two unsigned quantities.  Introduce a small static function to
clarify what we're doing, and call that instead.

Reviewed by:	hrs
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D1197
2014-11-22 23:04:33 +00:00
..
advcap.c
advcap.h
config.c
config.h
control.c
control.h
control_client.c
control_client.h
control_server.c
control_server.h
if.c
if.h
Makefile
pathnames.h
rrenum.c
rrenum.h
rtadvd.8
rtadvd.c Fix the following -Werror warnings from clang 3.5.0, while building 2014-11-22 23:04:33 +00:00
rtadvd.conf
rtadvd.conf.5
rtadvd.h
timer.c
timer.h
timer_subr.c
timer_subr.h