Use bam_init1/bam_destroy1 instead of creating/destroying by hand

Prefer explicit NULLing to historically non-portable memset obscureness.
Make samtools merge work with SAM input files

The iterator API doesn't (yet) work with SAM files, as there's no way
to provide the file's headers when initialising or using the iterator.
For SAM files (in the absence of -R REGION), keep the headers around so we
can use sam_read1() rather than sam_itr_queryi(HTS_IDX_REST)/sam_itr_next().

(This will likely be followed up with an option to write SAM output.)
Avoid crashing on unopenable files [minor]

Akin to fclose(), sam_close() requires the file pointer given to it to
be non-NULL; akin to free(), hts_itr_destroy() does not.  Fixes #327.
Parse mpileup -r region against the right file's headers

Restore the code prior to a bug introduced in e7ae7f96c7e78a2dd6eabdaed57037c483951929.
Amongst other things, this ensures that files without the given
reference sequence are reported as failing to parse the region.

Move the setting of data[i]->h lower in the loop to prevent similar
bugs in future.  Ensure that data[i]->iter is always explicitly set.
Merge branch 'develop' into amw-cat-file-list