[go: up one dir, main page]

Skip to content

Commit

Permalink
Merge pull request #1043 from jmarshall/no-tmp-object
Browse files Browse the repository at this point in the history
Avoid dangling reference to temporary string object
  • Loading branch information
arq5x authored Apr 13, 2023
2 parents b891a0b + 213f693 commit 42e0aeb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/utils/Fasta/Fasta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ FastaIndex::FastaIndex(bool useFullHeader)
void FastaIndex::readIndexFile(string fname) {

faidx = fai_load(fname.c_str());
const char *idx_path = (fname + ".fai").c_str();
string idx_path = fname + ".fai";

// NOTE: can use faidx_set_cache_size to improve performance of repeated queries.
if(faidx == NULL) {
Expand All @@ -44,7 +44,7 @@ void FastaIndex::readIndexFile(string fname) {
}

struct stat index_attr, fasta_attr;
stat(idx_path, &index_attr);
stat(idx_path.c_str(), &index_attr);
stat(fname.c_str(), &fasta_attr);
if(fasta_attr.st_mtime > index_attr.st_mtime) {
cerr << "Warning: the index file is older than the FASTA file." << endl;
Expand Down Expand Up @@ -146,4 +146,4 @@ CHRPOS FastaReference::sequenceLength(string seqname) {
}
// 0 length means the chrom wasn't found
return 0;
}
}

0 comments on commit 42e0aeb

Please sign in to comment.