Skip to content

Commit

Permalink
fwrite comment added only. #580
Browse files Browse the repository at this point in the history
  • Loading branch information
mattdowle committed Apr 15, 2016
1 parent bebcdc8 commit dcf8aaf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/fwrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,18 @@
#define WRITE write
#define CLOSE close
#endif

static inline int maxStrLen(SEXP x, int na_len) {
// The max nchar of any string in a column or factor level
int max=na_len, nrow=length(x);
for (int i=0; i<nrow; i++) {
int l = LENGTH(STRING_ELT(x,i));
if (l>max) max=l;
}
// TODO if(quote) count them here (we hopped already to get LENGTH), add that quote count to max
// exactly and remove the *(1+quote) later
// if there are no quotes present in any string in a column save in quotePresent[ncol] lookup
// and switch to memcpy when it's known no quotes are present to be escaped for that column
return max;
}

Expand Down

0 comments on commit dcf8aaf

Please sign in to comment.