Add for_each_as_ptr()

for_each_as_ptr is better than for_each since it avoids a copy.
Furthermore, it enables the use of other useful macros such as
container_of().

Also change the guard for fwm_each.h from FWM_EACH to FWM_FOR_EACH for
consistency.
Add more compatibility with FWM_MALLOC and FWM_MALLOC_FMT

Allows for alternate malloc implementations to be used.
Split minmax() into min() and max()
Add filter()
Fix compilation and failed unit tests

`make debug` triggered a few compilation errors.  Also fix some failing
unit tests.