* search.c: #include "region-cache.h".
(max, min): Make these functions, not macros; we'd like to pass
them arguments that would be bad to evaluate more than once.
(newline_cache_on_off): New function.
(scan_buffer): New argument END. Call newline_cache_on_off. If
this buffer's newline cache is enabled, consult it to see if we
need to scan a region for newlines, and store information in the
cache after doing so.
(find_next_newline): Pass new arg to scan_buffer.
(find_before_next_newline): New function.