Skip to content
Snippets Groups Projects
Commit d655c200 authored by Mayo Roettger's avatar Mayo Roettger
Browse files

fixed PROTECT bug

parent de5cfb0a
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ Package: glpkAPI ...@@ -2,7 +2,7 @@ Package: glpkAPI
Type: Package Type: Package
Title: R Interface to C API of GLPK Title: R Interface to C API of GLPK
Version: 1.3.1 Version: 1.3.1
Date: 2018-09-03 Date: 2018-09-13
Authors@R: c(person("Mayo", "Roettger", email = "mayo.roettger@hhu.de", role = "cre"), Authors@R: c(person("Mayo", "Roettger", email = "mayo.roettger@hhu.de", role = "cre"),
person("Gabriel", "Gelius-Dietrich", role = "aut", email = "geliudie@uni-duesseldorf.de"), person("Gabriel", "Gelius-Dietrich", role = "aut", email = "geliudie@uni-duesseldorf.de"),
person("Louis", "Luangkesorn", email = "lugerpitt@gmail.com", role = "ctb" )) person("Louis", "Luangkesorn", email = "lugerpitt@gmail.com", role = "ctb" ))
...@@ -13,7 +13,7 @@ SystemRequirements: GLPK (>= 4.42) ...@@ -13,7 +13,7 @@ SystemRequirements: GLPK (>= 4.42)
License: GPL-3 License: GPL-3
LazyLoad: yes LazyLoad: yes
Collate: generics.R glpk_ptrClass.R glpk.R glpkAPI.R zzz.R Collate: generics.R glpk_ptrClass.R glpk.R glpkAPI.R zzz.R
Packaged: 2018-09-03 08:30:00 UTC; mayo Packaged: 2018-09-13 14:05:00 UTC; mayo
NeedsCompilation: yes NeedsCompilation: yes
Repository: CRAN Repository: CRAN
Date/Publication: 2018-09-03 08:30:00 Date/Publication: 2018-09-13 14:05:00
...@@ -5,8 +5,10 @@ ...@@ -5,8 +5,10 @@
\encoding{UTF-8} \encoding{UTF-8}
% ---------------------------------------------------------------------------- % % ---------------------------------------------------------------------------- %
\section{Changes in version 1.3.1 2018-08-22}{ \section{Changes in version 1.3.1 2018-09-13}{
\itemize{ \itemize{
\item{fixed a bug where an allocating function was called with an unprotected
allocated R object in a makro funtion defined in \file{glpkAPI.h}.}
\item{changed package maintainer} \item{changed package maintainer}
} }
} }
......
...@@ -145,7 +145,7 @@ ...@@ -145,7 +145,7 @@
const int *rm = INTEGER(m); \ const int *rm = INTEGER(m); \
const int *rn = INTEGER(n); \ const int *rn = INTEGER(n); \
oind = R_Calloc(Rf_asInteger(ne), int); \ oind = R_Calloc(Rf_asInteger(ne), int); \
R_orderVector(oind, Rf_asInteger(ne), Rf_lang2(m, n), TRUE, FALSE); \ R_orderVector(oind, Rf_asInteger(ne), PROTECT(Rf_lang2(m, n)), TRUE, FALSE); \
while (y < Rf_asInteger(ne)) { \ while (y < Rf_asInteger(ne)) { \
if ( (rm[oind[y-1]] == rm[oind[y]]) && (rn[oind[y-1]] == rn[oind[y]]) ) { \ if ( (rm[oind[y-1]] == rm[oind[y]]) && (rn[oind[y-1]] == rn[oind[y]]) ) { \
dupA = oind[y-1]; \ dupA = oind[y-1]; \
...@@ -158,6 +158,7 @@ ...@@ -158,6 +158,7 @@
if (dupB) { \ if (dupB) { \
Rf_error("Duplicate indices 'ia[%i] = ia[%i] = %i' and 'ja[%i] = ja[%i] = %i' not allowed!", dupA+1, dupB+1, rm[dupA], dupA+1, dupB+1, rn[dupB]); \ Rf_error("Duplicate indices 'ia[%i] = ia[%i] = %i' and 'ja[%i] = ja[%i] = %i' not allowed!", dupA+1, dupB+1, rm[dupA], dupA+1, dupB+1, rn[dupB]); \
} \ } \
UNPROTECT(1)
} while (0) } while (0)
#else #else
#define checkDupIndices(m, n, ne) #define checkDupIndices(m, n, ne)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment