Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
markvanderloo committed Dec 29, 2020
1 parent 177c9a1 commit c5a1f87
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Description: Implements an approximate string matching version of R's native
vectors representing generic sequences. This package is built for speed and
runs in parallel by using 'openMP'. An API for C or C++ is exposed as well.
Reference: MPJ van der Loo (2014) <doi:10.32614/RJ-2014-011>.
Version: 0.9.6.3
Version: 0.9.6.3.1
Depends:
R (>= 2.15.3)
URL: https://github.com/markvanderloo/stringdist
Expand Down
4 changes: 4 additions & 0 deletions pkg/NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
version 0.9.6.4
- Fixed bug that caused a segfault when 'afind' was called with many
search patterns or many texts to be searched.

version 0.9.6.3
- Resubmit. Fixed an URL redirect that was detected by CRAN.

Expand Down
9 changes: 3 additions & 6 deletions pkg/src/Rstringdist.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,17 +352,15 @@ SEXP R_afind(SEXP a, SEXP pattern, SEXP width

// output location
SEXP out_loc;
out_loc = allocMatrix(INTSXP, na, npat);
PROTECT(out_loc = allocMatrix(INTSXP, na, npat));
VECTOR_ELT(out_list,0) = out_loc;
int *yloc = INTEGER(out_loc);

// output distance
SEXP out_dist;
out_dist = allocMatrix(REALSXP, na, npat);
PROTECT(out_dist = allocMatrix(REALSXP, na, npat));
VECTOR_ELT(out_list,1) = out_dist;
double *ydist = REAL(out_dist);


// Setup stringdist structure.
// find maximum window length
int max_window = 0;
Expand Down Expand Up @@ -402,7 +400,6 @@ SEXP R_afind(SEXP a, SEXP pattern, SEXP width

double d, d_min;


#ifdef _OPENMP
ID = omp_get_thread_num();
num_threads = omp_get_num_threads();
Expand Down Expand Up @@ -440,7 +437,7 @@ SEXP R_afind(SEXP a, SEXP pattern, SEXP width
} // end loop over strings
close_stringdist(sd);
} // end parallel region
UNPROTECT(1);
UNPROTECT(3);
return(out_list);

}
Expand Down

0 comments on commit c5a1f87

Please sign in to comment.