Skip to content

Commit e52c72c

Browse files
rm debugging markup
1 parent e382436 commit e52c72c

File tree

1 file changed

+1
-31
lines changed

1 file changed

+1
-31
lines changed

src/nafill.c

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,9 @@ void nafillInteger(int32_t *x, uint_fast64_t nx, unsigned int type, int32_t fill
4747
if (verbose)
4848
tic = omp_get_wtime();
4949
if (type==0) { // const
50-
//Rprintf("fill=%d\n",fill);
5150
for (uint_fast64_t i=0; i<nx; i++) {
52-
//Rprintf("before write: x[%d]=%d\n",i,x[i]);
5351
ans->int_v[i] = x[i]==NA_INTEGER ? fill : x[i];
54-
//Rprintf("after write: ans->int_v[%d]=%d\n",i,ans->int_v[i]);
5552
}
56-
//Rprintf("ans->int_v[nx-1]=%d\n",ans->int_v[nx-1]);
5753
} else if (type==1) { // locf
5854
ans->int_v[0] = x[0]==NA_INTEGER ? fill : x[0];
5955
for (uint_fast64_t i=1; i<nx; i++) {
@@ -95,16 +91,9 @@ void nafillString(const SEXP *x, uint_fast64_t nx, unsigned int type, SEXP fill,
9591
if (verbose)
9692
tic = omp_get_wtime();
9793
if (type==0) { // const
98-
//for (uint_fast64_t i=0; i<nx; i++) Rprintf("x[%d]=%s\n", i, CHAR(x[i]));
9994
for (uint_fast64_t i=0; i<nx; i++) {
10095
SET_STRING_ELT(ans->char_v, i, x[i]==NA_STRING ? fill : x[i]);
101-
//Rprintf("x[%d]=%s -> ", i, CHAR(x[i]));
102-
//SEXP tmp = x[i]==NA_STRING ? fill : x[i]; // setnafill handle to not update when reading
103-
//Rprintf("tmp=%s -> ", CHAR(tmp));
104-
//SET_STRING_ELT((SEXP)ans->char_v, i, tmp);
105-
//Rprintf("y[%d]=%s\n", i, CHAR(STRING_ELT((SEXP)ans->char_v, i)));
10696
}
107-
//for (uint_fast64_t i=0; i<nx; i++) Rprintf("y[%d]=%s\n", i, CHAR(STRING_ELT((SEXP)ans->char_v, i)));
10897
} else if (type==1) { // locf
10998
SET_STRING_ELT(ans->char_v, 0, x[0]==NA_STRING ? fill : x[0]);
11099
const SEXP* thisans = SEXPPTR_RO(ans->char_v); // takes out STRING_ELT from loop
@@ -214,7 +203,6 @@ SEXP nafillR(SEXP obj, SEXP type, SEXP fill, SEXP nan_is_na_arg, SEXP inplace, S
214203
vans[i] = ((ans_t) { .dbl_v=(double *)p, .int_v=(int *)p, .int64_v=(int64_t *)p, .char_v=(SEXP)p, .status=0, .message={"\0","\0","\0","\0"} });
215204
}
216205
} else {
217-
//ans = x; // only for debugging
218206
if (hadChar)
219207
error("setnafill and character column not yet implemented");
220208
for (R_len_t i=0; i<nx; i++) {
@@ -245,7 +233,6 @@ SEXP nafillR(SEXP obj, SEXP type, SEXP fill, SEXP nan_is_na_arg, SEXP inplace, S
245233
hasFill = false;
246234
}
247235
if (!badFill && hasFill) {
248-
//Rprintf("hasFill branch\n");
249236
if (obj_scalar && isNewList(fill))
250237
badFill = true;
251238
if (!badFill && !isNewList(fill) && length(fill)!=1)
@@ -272,23 +259,12 @@ SEXP nafillR(SEXP obj, SEXP type, SEXP fill, SEXP nan_is_na_arg, SEXP inplace, S
272259
if (!isNewList(fill))
273260
internal_error(__func__, "'fill' should be recycled as list already"); // # nocov
274261
for (R_len_t i=0; i<nx; i++) {
275-
//Rprintf("coercing fill[i]=\n");
276-
//Rf_PrintValue(VECTOR_ELT(fill, i));
277-
//Rprintf("to match x=\n");
278-
//Rf_PrintValue(VECTOR_ELT(x, i));
279262
SET_VECTOR_ELT(fill, i, coerceAs(VECTOR_ELT(fill, i), VECTOR_ELT(x, i), ScalarLogical(TRUE)));
280263
if (isFactor(VECTOR_ELT(x, i)) && hasFill)
281264
error("'fill' on factor columns is not yet implemented");
282265
fillp[i] = SEXPPTR_RO(VECTOR_ELT(fill, i)); // do like this so we can use in parallel region
283266
}
284-
//Rprintf("hasFill branch3\n");
285267
}
286-
//Rprintf("before loop\n");
287-
//Rf_PrintValue(ans);
288-
//Rf_PrintValue(VECTOR_ELT(ans, 0));
289-
//Rprintf("TYPEOF(ans)=%s\n", type2char(TYPEOF(VECTOR_ELT(ans, 0))));
290-
//Rprintf("before loop fill\n");
291-
//Rf_PrintValue(VECTOR_ELT(fill, 0));
292268
#pragma omp parallel for if (nx>1 && !hadChar) num_threads(getDTthreads(nx, true))
293269
for (R_len_t i=0; i<nx; i++) {
294270
switch (TYPEOF(VECTOR_ELT(x, i))) {
@@ -308,10 +284,6 @@ SEXP nafillR(SEXP obj, SEXP type, SEXP fill, SEXP nan_is_na_arg, SEXP inplace, S
308284
}
309285
}
310286

311-
//Rprintf("after loop\n");
312-
//Rprintf("TYPEOF(ans)=%s\n", type2char(TYPEOF(VECTOR_ELT(ans, 0))));
313-
//Rf_PrintValue(VECTOR_ELT(ans, 0));
314-
315287
if (!binplace) {
316288
for (R_len_t i=0; i<nx; i++) {
317289
if (!isNull(ATTRIB(VECTOR_ELT(x, i)))) {
@@ -329,7 +301,7 @@ SEXP nafillR(SEXP obj, SEXP type, SEXP fill, SEXP nan_is_na_arg, SEXP inplace, S
329301
setAttrib(ans, R_NamesSymbol, ans_names);
330302
}
331303
}
332-
//Rprintf("before ansMsg\n");
304+
333305
ansMsg(vans, nx, verbose, __func__);
334306

335307
if (verbose)
@@ -342,8 +314,6 @@ SEXP nafillR(SEXP obj, SEXP type, SEXP fill, SEXP nan_is_na_arg, SEXP inplace, S
342314
if (binplace) {
343315
return obj;
344316
} else {
345-
//Rprintf("returning VECTOR_ELT(ans, 0)\n");
346-
//Rf_PrintValue(VECTOR_ELT(ans, 0));
347317
return obj_scalar && length(ans) == 1 ? VECTOR_ELT(ans, 0) : ans;
348318
}
349319
}

0 commit comments

Comments
 (0)