clw
2017-04-25 11:33:35 UTC
Hi,
I am using htslib in some of the tools I write, and I am wondering if
its safe to memcpy the hts_itr_t struct to be able to use it multiple
times (on the same bam file, with the exact same region queried)? I am
using the iterator through sam_itr_next() (i.e. hts_itr_next()), and
from what I can see, the pointers within hts_itr_t do not get touched in
the process. Would it be safe then to memcpy an allocated hts_itr_t
struct so that the changes to the 'finished' bit as well as the
'curr_xxx' variables only occur in the copied struct rather than the
source? Or is it necessary to destroy the struct and reload it for reuse?
Thanks!
clw
I am using htslib in some of the tools I write, and I am wondering if
its safe to memcpy the hts_itr_t struct to be able to use it multiple
times (on the same bam file, with the exact same region queried)? I am
using the iterator through sam_itr_next() (i.e. hts_itr_next()), and
from what I can see, the pointers within hts_itr_t do not get touched in
the process. Would it be safe then to memcpy an allocated hts_itr_t
struct so that the changes to the 'finished' bit as well as the
'curr_xxx' variables only occur in the copied struct rather than the
source? Or is it necessary to destroy the struct and reload it for reuse?
Thanks!
clw