On Mon, Nov 20, 2017 at 8:34 PM, Patrick Perry <ppe...@stern.nyu.edu> wrote: > One of my packages has what I believe to be spurious rchk warnings: > > From > https://raw.githubusercontent.com/kalibera/cran-checks/master/rchk/results/utf8.out > > Package utf8 version 1.1.0 > Package built using 73757/R 3.5.0; x86_64-pc-linux-gnu; 2017-11-20 22:02:23 > UTC; unix > Checked with rchk version 63f79d910f5835174fcaa5a0a7d2409348f7d2ac > More information at > https://github.com/kalibera/cran-checks/blob/master/rchk/PROTECT.md > > Function rutf8_as_utf8 > [UP] unprotected variable ans while calling allocating function > R_CheckUserInterrupt utf8/src/as_utf8.c:68 > [UP] unprotected variable ans while calling allocating function > rutf8_translate_utf8 utf8/src/as_utf8.c:83 > [UP] unprotected variable ans while calling allocating function > Rf_mkCharLenCE utf8/src/as_utf8.c:117 > > The offending function is at > https://github.com/patperry/r-utf8/blob/master/src/as_utf8.c#L46 > > I tried to fix the warning in line 64 with > > PROTECT(ans = sx); nprot++; > > This did not work. Any suggestions? > My hypothesis is that your PROTECT and UNPROTECT calls inside the for loop are leaving 'ans' unprotected at some point. Consider using PROTECT_WITH_INDEX() and REPROTECT() instead.
> Thanks, > > > Patrick > > ______________________________________________ > R-package-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-package-devel -- Joshua Ulrich | about.me/joshuaulrich FOSS Trading | www.fosstrading.com R/Finance 2017 | www.rinfinance.com ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel