Skip to content

Commit

Permalink
Add duplicateString().
Browse files Browse the repository at this point in the history
  • Loading branch information
brianwalenz committed Sep 11, 2017
1 parent 61ac3f8 commit db55805
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/AS_UTL/AS_UTL_alloc.H
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,19 @@ allocateArray(TT*& array, LL arrayMax, uint32 op=resizeArray_clearNew) {



template<typename TT>
TT *
duplicateString(TT const *fr) {
uint32 ln = strlen(fr);
TT *to = new TT [ln+1];

memcpy(to, fr, sizeof(TT) * (ln+1));

return(to);
}



template<typename TT, typename LL>
void
duplicateArray(TT*& to, LL &toLen, LL &toMax, TT *fr, LL frLen, LL UNUSED(frMax), bool forceAlloc=false) {
Expand Down

0 comments on commit db55805

Please sign in to comment.