Skip to content

Commit ea98c19

Browse files
committed
removal of empty lines
1 parent e75bc73 commit ea98c19

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

src/fmelt.c

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include "data.table.h"
22
#include <Rdefines.h>
3-
43
// #include <signal.h> // the debugging machinery + breakpoint aidee
54
// raise(SIGINT);
65

@@ -178,64 +177,46 @@ bool is_default_measure(SEXP vec) {
178177
// maybe unlist, then unique, then set_diff.
179178
SEXP uniq_diff(SEXP int_or_list, int ncol, bool is_measure) {
180179
SEXP int_vec = PROTECT(isNewList(int_or_list) ? unlist_(int_or_list) : int_or_list);
181-
182180
SEXP is_duplicated = PROTECT(duplicated(int_vec, FALSE));
183-
184181
int n_unique_cols = 0;
185-
186182
SEXP invalid_columns = PROTECT(allocVector(INTSXP, length(int_vec)));
187183
int* invalid_col_ptr = INTEGER(invalid_columns);
188184
int invalid_count = 0;
189-
190185
for (int i = 0; i < length(int_vec); ++i) {
191186
int col_number = INTEGER(int_vec)[i];
192-
193187
bool good_number = 0 < col_number && col_number <= ncol;
194-
195188
if (is_measure) good_number |= (col_number == NA_INTEGER);
196-
197189
if (!good_number || col_number == 0) {
198190
invalid_col_ptr[invalid_count++] = col_number;
199191
} else if (!LOGICAL(is_duplicated)[i]) {
200192
n_unique_cols++;
201193
}
202194
}
203-
204195
if (invalid_count > 0) {
205196
char buffer[4096] = "";
206197
for (int i = 0; i < invalid_count; ++i) {
207198
char temp[32];
208199
snprintf(temp, 32, "[%d]", invalid_col_ptr[i]);
209-
210200
if (i > 0) {
211201
strncat(buffer, ", ", sizeof(buffer) - strlen(buffer) - 1);
212202
}
213203
strncat(buffer, temp, sizeof(buffer) - strlen(buffer) - 1);
214204
}
215-
216-
error(_("One or more values in '%s' are invalid; please fix by removing: %s"),
205+
error(_("One or more values in '%s' are invalid; please fix by removing: %s"),
217206
is_measure ? "measure.vars" : "id.vars", buffer);
218207
}
219-
220208
SEXP unique_col_numbers = PROTECT(allocVector(INTSXP, n_unique_cols));
221209
int unique_i = 0;
222-
223210
for (int i = 0; i < length(is_duplicated); ++i) {
224211
if (!LOGICAL(is_duplicated)[i]) {
225212
INTEGER(unique_col_numbers)[unique_i++] = INTEGER(int_vec)[i];
226213
}
227214
}
228-
229215
SEXP out = set_diff(unique_col_numbers, ncol);
230-
231216
UNPROTECT(4);
232-
233217
return out;
234218
}
235219

236-
237-
238-
239220
SEXP cols_to_int_or_list(SEXP cols, SEXP dtnames, bool is_measure) {
240221
switch(TYPEOF(cols)) {
241222
case STRSXP : return chmatch(cols, dtnames, 0);

0 commit comments

Comments
 (0)