Skip to content

Commit e44e72c

Browse files
authored
Merge branch 'master' into stdisfinite
2 parents 99579c7 + 053d905 commit e44e72c

File tree

3 files changed

+23
-25
lines changed

3 files changed

+23
-25
lines changed

src/fmelt.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -282,23 +282,23 @@ SEXP checkVars(SEXP DT, SEXP id, SEXP measure, Rboolean verbose) {
282282
}
283283

284284
struct processData {
285-
SEXP RCHK; // a 2 item list holding vars (result of checkVars) and not_NA_indices. PROTECTed up in fmelt so that preprocess() doesn't need to PROTECT. To pass rchk, #2865
286-
SEXP idcols, // convenience pointers into RCHK[0][0], RCHK[0][1] and RCHK[1] respectively
287-
variable_table, // NULL or data for variable column(s).
288-
valuecols, // list with one element per output/value column, each element is an integer vector.
289-
not_NA_indices;
290-
int *isfactor,
291-
*leach, // length of each element of the valuecols(measure.vars) list.
292-
*isidentical; // are all inputs for this value column the same type?
293-
int lids, // number of id columns.
294-
lvars, // number of variable columns.
295-
lvalues, // number of value columns.
296-
lmax, // max length of valuecols elements / number of times to repeat ids.
297-
totlen, // of output/long DT result of melt operation.
298-
nrow; // of input/wide DT to be melted.
285+
SEXP RCHK; // a 2 item list holding vars (result of checkVars) and not_NA_indices. PROTECTed up in fmelt so that preprocess() doesn't need to PROTECT. To pass rchk, #2865
286+
SEXP idcols; // convenience pointers into RCHK[0][0], RCHK[0][1] and RCHK[1] respectively
287+
SEXP variable_table; // NULL or data for variable column(s).
288+
SEXP valuecols; // list with one element per output/value column, each element is an integer vector.
289+
SEXP not_NA_indices;
290+
int *isfactor;
291+
int *leach; // length of each element of the valuecols(measure.vars) list.
292+
int *isidentical; // are all inputs for this value column the same type?
293+
int lids; // number of id columns.
294+
int lvars; // number of variable columns.
295+
int lvalues; // number of value columns.
296+
int lmax; // max length of valuecols elements / number of times to repeat ids.
297+
int totlen; // of output/long DT result of melt operation.
298+
int nrow; // of input/wide DT to be melted.
299299
SEXPTYPE *maxtype;
300-
bool measure_is_list,
301-
narm; // remove missing values?
300+
bool measure_is_list;
301+
bool narm; // remove missing values?
302302
};
303303

304304
static void preprocess(SEXP DT, SEXP id, SEXP measure, SEXP varnames, SEXP valnames, Rboolean narm, Rboolean verbose, struct processData *data) {

src/freadR.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,15 +265,13 @@ bool userOverride(int8_t *type, lenOff *colNames, const char *anchor, const int
265265
colNamesSxp = R_NilValue;
266266
SET_VECTOR_ELT(RCHK, 1, colNamesSxp = allocVector(STRSXP, ncol));
267267
for (int i = 0; i < ncol; i++) {
268-
SEXP elem;
269268
if (colNames == NULL || colNames[i].len <= 0) {
270269
char buff[12];
271270
snprintf(buff, sizeof(buff), "V%d", i + 1); // # notranslate
272-
elem = mkChar(buff); // no PROTECT as passed immediately to SET_STRING_ELT
271+
SET_STRING_ELT(colNamesSxp, i, mkChar(buff)); // no PROTECT as passed immediately to SET_STRING_ELT
273272
} else {
274-
elem = mkCharLenCE(anchor + colNames[i].off, colNames[i].len, ienc); // no PROTECT as passed immediately to SET_STRING_ELT
273+
SET_STRING_ELT(colNamesSxp, i, mkCharLenCE(anchor + colNames[i].off, colNames[i].len, ienc)); // no PROTECT as passed immediately to SET_STRING_ELT
275274
}
276-
SET_STRING_ELT(colNamesSxp, i, elem);
277275
}
278276
// "use either select= or drop= but not both" was checked earlier in freadR
279277
applyDrop(dropSxp, type, ncol, /*dropSource=*/-1);

src/quickselect.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
// from good ol' Numerical Recipes in C
44

5-
static inline void iswap(int *a, int *b) {int tmp=*a; *a=*b; *b=tmp;}
6-
static inline void dswap(double *a, double *b) {double tmp=*a; *a=*b; *b=tmp;}
7-
static inline void i64swap(int64_t *a, int64_t *b) {int64_t tmp=*a; *a=*b; *b=tmp;}
5+
static inline void iswap(int *a, int *b) { int tmp = *a; *a = *b; *b = tmp; }
6+
static inline void dswap(double *a, double *b) { double tmp = *a; *a = *b; *b = tmp; }
7+
static inline void i64swap(int64_t *a, int64_t *b) { int64_t tmp = *a; *a = *b; *b = tmp; }
88

99
#undef BODY
1010
#define BODY(SWAP) \
@@ -30,7 +30,7 @@ static inline void i64swap(int64_t *a, int64_t *b) {int64_t tmp=*a; *a=*b; *b=tm
3030
SWAP(x + l, x + l + 1); \
3131
} \
3232
unsigned long i = l + 1, j = ir; \
33-
a=x[l + 1]; \
33+
a = x[l + 1]; \
3434
for (;;) { \
3535
do i++; while (x[i] < a); \
3636
do j--; while (x[j] > a); \
@@ -44,7 +44,7 @@ static inline void i64swap(int64_t *a, int64_t *b) {int64_t tmp=*a; *a=*b; *b=tm
4444
} \
4545
} \
4646
a = x[med]; \
47-
if (n%2 == 1) { \
47+
if (n % 2 == 1) { \
4848
return (double)a; \
4949
} else { \
5050
b = x[med + 1]; \

0 commit comments

Comments
 (0)