Skip to content

Commit 8fc0eab

Browse files
authored
Merge pull request #560 from thirdwing/iss391_patch1
Change string_elt/vector_elt to accept R_xlen_t
2 parents a2794ab + 6b7865d commit 8fc0eab

File tree

4 files changed

+36
-30
lines changed

4 files changed

+36
-30
lines changed

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2016-10-21 Qiang Kou <[email protected]>
2+
3+
* inst/include/Rcpp/barrier.h: Change string_elt/vector_elt to accept R_xlen_t
4+
* inst/include/Rcpp/routines.h: Ditto
5+
* src/barrier.cpp: Ditto
6+
17
2016-10-19 Dirk Eddelbuettel <[email protected]>
28

39
* inst/include/Rcpp/date_datetime/Datetime.h (Rcpp): Additional

inst/include/Rcpp/barrier.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222
#ifndef Rcpp__barrier__h
2323
#define Rcpp__barrier__h
2424

25-
SEXP get_string_elt(SEXP, int) ;
26-
const char* char_get_string_elt(SEXP, int) ;
27-
void set_string_elt(SEXP, int, SEXP) ;
28-
void char_set_string_elt(SEXP, int, const char*) ;
25+
SEXP get_string_elt(SEXP, R_xlen_t) ;
26+
const char* char_get_string_elt(SEXP, R_xlen_t) ;
27+
void set_string_elt(SEXP, R_xlen_t, SEXP) ;
28+
void char_set_string_elt(SEXP, R_xlen_t, const char*) ;
2929
SEXP* get_string_ptr(SEXP) ;
3030

31-
SEXP get_vector_elt(SEXP, int) ;
32-
void set_vector_elt(SEXP, int, SEXP ) ;
31+
SEXP get_vector_elt(SEXP, R_xlen_t) ;
32+
void set_vector_elt(SEXP, R_xlen_t, SEXP ) ;
3333
SEXP* get_vector_ptr(SEXP) ;
3434
const char* char_nocheck( SEXP ) ;
3535
void* dataptr(SEXP) ;

inst/include/Rcpp/routines.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ std::string demangle(const std::string& name);
4444
const char* short_file_name(const char* );
4545
int* get_cache(int n);
4646
SEXP stack_trace( const char *file, int line);
47-
SEXP get_string_elt(SEXP s, int i);
48-
const char* char_get_string_elt(SEXP s, int i);
49-
void set_string_elt(SEXP s, int i, SEXP v);
50-
void char_set_string_elt(SEXP s, int i, const char* v);
47+
SEXP get_string_elt(SEXP s, R_xlen_t i);
48+
const char* char_get_string_elt(SEXP s, R_xlen_t i);
49+
void set_string_elt(SEXP s, R_xlen_t i, SEXP v);
50+
void char_set_string_elt(SEXP s, R_xlen_t i, const char* v);
5151
SEXP* get_string_ptr(SEXP s);
52-
SEXP get_vector_elt(SEXP v, int i);
53-
void set_vector_elt(SEXP v, int i, SEXP x);
52+
SEXP get_vector_elt(SEXP v, R_xlen_t i);
53+
void set_vector_elt(SEXP v, R_xlen_t i, SEXP x);
5454
SEXP* get_vector_ptr(SEXP v);
5555
const char* char_nocheck(SEXP x);
5656
void* dataptr(SEXP x);
@@ -149,26 +149,26 @@ inline attribute_hidden SEXP stack_trace( const char *file, int line){
149149
return fun(file, line);
150150
}
151151

152-
inline attribute_hidden SEXP get_string_elt(SEXP s, int i){
153-
typedef SEXP (*Fun)(SEXP, int);
152+
inline attribute_hidden SEXP get_string_elt(SEXP s, R_xlen_t i){
153+
typedef SEXP (*Fun)(SEXP, R_xlen_t);
154154
static Fun fun = GET_CALLABLE("get_string_elt");
155155
return fun(s, i);
156156
}
157157

158-
inline attribute_hidden const char* char_get_string_elt(SEXP s, int i){
159-
typedef const char* (*Fun)(SEXP, int);
158+
inline attribute_hidden const char* char_get_string_elt(SEXP s, R_xlen_t i){
159+
typedef const char* (*Fun)(SEXP, R_xlen_t);
160160
static Fun fun = GET_CALLABLE("char_get_string_elt");
161161
return fun(s, i);
162162
}
163163

164-
inline attribute_hidden void set_string_elt(SEXP s, int i, SEXP v){
165-
typedef void (*Fun)(SEXP,int,SEXP);
164+
inline attribute_hidden void set_string_elt(SEXP s, R_xlen_t i, SEXP v){
165+
typedef void (*Fun)(SEXP, R_xlen_t, SEXP);
166166
static Fun fun = GET_CALLABLE("set_string_elt");
167167
fun(s, i, v);
168168
}
169169

170-
inline attribute_hidden void char_set_string_elt(SEXP s, int i, const char* v){
171-
typedef void (*Fun)(SEXP,int, const char*);
170+
inline attribute_hidden void char_set_string_elt(SEXP s, R_xlen_t i, const char* v){
171+
typedef void (*Fun)(SEXP, R_xlen_t, const char*);
172172
static Fun fun = GET_CALLABLE("char_set_string_elt");
173173
fun(s, i, v );
174174
}
@@ -179,14 +179,14 @@ inline attribute_hidden SEXP* get_string_ptr(SEXP s){
179179
return fun(s);
180180
}
181181

182-
inline attribute_hidden SEXP get_vector_elt(SEXP v, int i){
183-
typedef SEXP (*Fun)(SEXP, int );
182+
inline attribute_hidden SEXP get_vector_elt(SEXP v, R_xlen_t i){
183+
typedef SEXP (*Fun)(SEXP, R_xlen_t);
184184
static Fun fun = GET_CALLABLE("get_vector_elt");
185185
return fun(v, i);
186186
}
187187

188-
inline attribute_hidden void set_vector_elt(SEXP v, int i, SEXP x){
189-
typedef void (*Fun)(SEXP, int, SEXP);
188+
inline attribute_hidden void set_vector_elt(SEXP v, R_xlen_t i, SEXP x){
189+
typedef void (*Fun)(SEXP, R_xlen_t, SEXP);
190190
static Fun fun = GET_CALLABLE("set_vector_elt");
191191
fun(v, i, x);
192192
}

src/barrier.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,22 @@
3131
namespace Rcpp { SEXP Rcpp_eval(SEXP, SEXP); }
3232

3333
// [[Rcpp::register]]
34-
SEXP get_string_elt(SEXP x, int i) {
34+
SEXP get_string_elt(SEXP x, R_xlen_t i) {
3535
return STRING_ELT(x, i);
3636
}
3737

3838
// [[Rcpp::register]]
39-
const char* char_get_string_elt(SEXP x, int i) {
39+
const char* char_get_string_elt(SEXP x, R_xlen_t i) {
4040
return CHAR(STRING_ELT(x, i));
4141
}
4242

4343
// [[Rcpp::register]]
44-
void set_string_elt(SEXP x, int i, SEXP value) {
44+
void set_string_elt(SEXP x, R_xlen_t i, SEXP value) {
4545
SET_STRING_ELT(x, i, value);
4646
}
4747

4848
// [[Rcpp::register]]
49-
void char_set_string_elt(SEXP x, int i, const char* value) {
49+
void char_set_string_elt(SEXP x, R_xlen_t i, const char* value) {
5050
SET_STRING_ELT(x, i, Rf_mkChar(value));
5151
}
5252

@@ -56,12 +56,12 @@ SEXP* get_string_ptr(SEXP x) {
5656
}
5757

5858
// [[Rcpp::register]]
59-
SEXP get_vector_elt(SEXP x, int i) {
59+
SEXP get_vector_elt(SEXP x, R_xlen_t i) {
6060
return VECTOR_ELT(x, i);
6161
}
6262

6363
// [[Rcpp::register]]
64-
void set_vector_elt(SEXP x, int i, SEXP value) {
64+
void set_vector_elt(SEXP x, R_xlen_t i, SEXP value) {
6565
SET_VECTOR_ELT(x, i, value);
6666
}
6767

0 commit comments

Comments
 (0)