1
- /* Copyright 2010 by Roger S. Bivand. */
1
+ /* Copyright 2010-24 by Roger S. Bivand. */
2
2
3
3
#include "spatialreg.h"
4
4
@@ -46,7 +46,7 @@ SEXP opt_error_init(void) { /* -Wstrict-prototypes */
46
46
OPT_ERROR_SSE * pt ;
47
47
SEXP ptr ;
48
48
49
- pt = Calloc (1 , OPT_ERROR_SSE );
49
+ pt = R_Calloc (1 , OPT_ERROR_SSE );
50
50
pt -> set = FALSE;
51
51
52
52
PROTECT (ptr = R_MakeExternalPtr (pt , R_NilValue , R_NilValue ));
@@ -76,18 +76,18 @@ void opt_error_set(SEXP env) {
76
76
PROTECT (wy = findVarInFrame (env , install ("wy" ))); pc ++ ;
77
77
PROTECT (WX = findVarInFrame (env , install ("WX" ))); pc ++ ;
78
78
79
- pt -> y = Calloc (n , double );
80
- pt -> x = Calloc (np , double );
81
- pt -> yl = Calloc (n , double );
82
- pt -> wy1 = Calloc (n , double );
83
- pt -> xlq = Calloc (np , double );
84
- pt -> wx1 = Calloc (np , double );
85
- pt -> qy = Calloc (np , double );
86
- pt -> xlqyl = Calloc (p , double );
87
- pt -> jpvt = Calloc (p , int );
88
- pt -> work = Calloc (p * 2 , double );
89
- /* pt->work = Calloc (p, double); */
90
- pt -> qraux = Calloc (p , double );
79
+ pt -> y = R_Calloc (n , double );
80
+ pt -> x = R_Calloc (np , double );
81
+ pt -> yl = R_Calloc (n , double );
82
+ pt -> wy1 = R_Calloc (n , double );
83
+ pt -> xlq = R_Calloc (np , double );
84
+ pt -> wx1 = R_Calloc (np , double );
85
+ pt -> qy = R_Calloc (np , double );
86
+ pt -> xlqyl = R_Calloc (p , double );
87
+ pt -> jpvt = R_Calloc (p , int );
88
+ pt -> work = R_Calloc (p * 2 , double );
89
+ /* pt->work = R_Calloc (p, double); */
90
+ pt -> qraux = R_Calloc (p , double );
91
91
92
92
for (i = 0 ; i < n ; i ++ ) {
93
93
pt -> y [i ] = NUMERIC_POINTER (y )[i ];
@@ -110,19 +110,19 @@ SEXP opt_error_free(SEXP ptr) {
110
110
111
111
pt = (OPT_ERROR_SSE * ) R_ExternalPtrAddr (ptr );
112
112
113
- Free (pt -> qraux );
114
- Free (pt -> work );
115
- Free (pt -> jpvt );
116
- Free (pt -> xlqyl );
117
- Free (pt -> qy );
118
- Free (pt -> wx1 );
119
- Free (pt -> xlq );
120
- Free (pt -> wy1 );
121
- Free (pt -> yl );
122
- Free (pt -> x );
123
- Free (pt -> y );
124
-
125
- Free (pt );
113
+ R_Free (pt -> qraux );
114
+ R_Free (pt -> work );
115
+ R_Free (pt -> jpvt );
116
+ R_Free (pt -> xlqyl );
117
+ R_Free (pt -> qy );
118
+ R_Free (pt -> wx1 );
119
+ R_Free (pt -> xlq );
120
+ R_Free (pt -> wy1 );
121
+ R_Free (pt -> yl );
122
+ R_Free (pt -> x );
123
+ R_Free (pt -> y );
124
+
125
+ R_Free (pt );
126
126
R_ClearExternalPtr (ptr );
127
127
return (R_NilValue );
128
128
}
@@ -132,7 +132,7 @@ SEXP hess_error_init(void) { /* -Wstrict-prototypes */
132
132
HESS_ERROR_SSE * pt ;
133
133
SEXP ptr ;
134
134
135
- pt = Calloc (1 , HESS_ERROR_SSE );
135
+ pt = R_Calloc (1 , HESS_ERROR_SSE );
136
136
pt -> set = FALSE;
137
137
138
138
PROTECT (ptr = R_MakeExternalPtr (pt , R_NilValue , R_NilValue ));
@@ -162,14 +162,14 @@ void hess_error_set(SEXP env) {
162
162
PROTECT (wy = findVarInFrame (env , install ("wy" ))); pc ++ ;
163
163
PROTECT (WX = findVarInFrame (env , install ("WX" ))); pc ++ ;
164
164
165
- pt -> y = Calloc (n , double );
166
- pt -> x = Calloc (np , double );
167
- pt -> yl = Calloc (n , double );
168
- pt -> wy1 = Calloc (n , double );
169
- pt -> xl = Calloc (np , double );
170
- pt -> wx1 = Calloc (np , double );
171
- pt -> beta1 = Calloc (p , double );
172
- pt -> xlb = Calloc (n , double );
165
+ pt -> y = R_Calloc (n , double );
166
+ pt -> x = R_Calloc (np , double );
167
+ pt -> yl = R_Calloc (n , double );
168
+ pt -> wy1 = R_Calloc (n , double );
169
+ pt -> xl = R_Calloc (np , double );
170
+ pt -> wx1 = R_Calloc (np , double );
171
+ pt -> beta1 = R_Calloc (p , double );
172
+ pt -> xlb = R_Calloc (n , double );
173
173
174
174
for (i = 0 ; i < n ; i ++ ) {
175
175
pt -> y [i ] = NUMERIC_POINTER (y )[i ];
@@ -192,16 +192,16 @@ SEXP hess_error_free(SEXP ptr) {
192
192
193
193
pt = (HESS_ERROR_SSE * ) R_ExternalPtrAddr (ptr );
194
194
195
- Free (pt -> xlb );
196
- Free (pt -> beta1 );
197
- Free (pt -> wx1 );
198
- Free (pt -> xl );
199
- Free (pt -> wy1 );
200
- Free (pt -> yl );
201
- Free (pt -> x );
202
- Free (pt -> y );
195
+ R_Free (pt -> xlb );
196
+ R_Free (pt -> beta1 );
197
+ R_Free (pt -> wx1 );
198
+ R_Free (pt -> xl );
199
+ R_Free (pt -> wy1 );
200
+ R_Free (pt -> yl );
201
+ R_Free (pt -> x );
202
+ R_Free (pt -> y );
203
203
204
- Free (pt );
204
+ R_Free (pt );
205
205
R_ClearExternalPtr (ptr );
206
206
return (R_NilValue );
207
207
}
@@ -211,7 +211,7 @@ SEXP hess_lag_init(void) { /* -Wstrict-prototypes */
211
211
HESS_LAG_SSE * pt ;
212
212
SEXP ptr ;
213
213
214
- pt = Calloc (1 , HESS_LAG_SSE );
214
+ pt = R_Calloc (1 , HESS_LAG_SSE );
215
215
pt -> set = FALSE;
216
216
217
217
PROTECT (ptr = R_MakeExternalPtr (pt , R_NilValue , R_NilValue ));
@@ -240,12 +240,12 @@ void hess_lag_set(SEXP env) {
240
240
PROTECT (x = findVarInFrame (env , install ("x" ))); pc ++ ;
241
241
PROTECT (wy = findVarInFrame (env , install ("wy" ))); pc ++ ;
242
242
243
- pt -> y = Calloc (n , double );
244
- pt -> x = Calloc (np , double );
245
- pt -> yl = Calloc (n , double );
246
- pt -> wy1 = Calloc (n , double );
247
- pt -> beta1 = Calloc (p , double );
248
- pt -> xb = Calloc (n , double );
243
+ pt -> y = R_Calloc (n , double );
244
+ pt -> x = R_Calloc (np , double );
245
+ pt -> yl = R_Calloc (n , double );
246
+ pt -> wy1 = R_Calloc (n , double );
247
+ pt -> beta1 = R_Calloc (p , double );
248
+ pt -> xb = R_Calloc (n , double );
249
249
250
250
for (i = 0 ; i < n ; i ++ ) {
251
251
pt -> y [i ] = NUMERIC_POINTER (y )[i ];
@@ -265,14 +265,14 @@ SEXP hess_lag_free(SEXP ptr) {
265
265
266
266
pt = (HESS_LAG_SSE * ) R_ExternalPtrAddr (ptr );
267
267
268
- Free (pt -> xb );
269
- Free (pt -> beta1 );
270
- Free (pt -> wy1 );
271
- Free (pt -> yl );
272
- Free (pt -> x );
273
- Free (pt -> y );
268
+ R_Free (pt -> xb );
269
+ R_Free (pt -> beta1 );
270
+ R_Free (pt -> wy1 );
271
+ R_Free (pt -> yl );
272
+ R_Free (pt -> x );
273
+ R_Free (pt -> y );
274
274
275
- Free (pt );
275
+ R_Free (pt );
276
276
R_ClearExternalPtr (ptr );
277
277
return (R_NilValue );
278
278
}
0 commit comments