search for: calloccharbuf

Displaying 7 results from an estimated 7 matches for "calloccharbuf".

2007 May 25
0
Recent changes in R related to CHARSXPs
...he char* returned by CHAR(). If you maintain a package that manipulates CHARSXPs, you should check to see if you make such in-place modifications. If you do, the general solution is as follows: If you need a temp char buffer, you can allocate one with a new helper macro like this: /* CallocCharBuf takes care of the +1 for the \0, so the size argument is the length of your string. */ char *tmp = CallocCharBuf(n); /* manipulate tmp */ SEXP schar = mkChar(tmp); Free(tmp); You can also use R_alloc which has the advantage of not having to free it in a .Cal...
2007 Sep 13
1
chartr better
...+) + if (tbl = bsearch(&wc[j], xtable, xtable_cnt, sizeof(xtable_t), + (int(*)(const void *, const void *))xtable_key_comp)) + wc[j]=tbl->c_new; nb = wcstombs(NULL, wc, 0); cbuf = CallocCharBuf(nb); wcstombs(cbuf, wc, nb + 1); -- EI-JI Nakama <nakama at ki.rim.or.jp> "\u4e2d\u9593\u6804\u6cbb" <nakama at ki.rim.or.jp>
2016 Jun 01
2
segfault / crash when asking for large memory via strrep()
We've had this more general topic on R-help, and also in R-devel recently. There's one case here where I get the feeling R never gets into swapping but more directly aborts possibly from a bug we can more easily fix. Today I've been working (successfully! - not yet committed) at fixing str() for very large strings. In this process, I've found that pc <- function(.)
2016 Jun 01
0
segfault / crash when asking for large memory via strrep()
That would be because the product nc * ni overflows in cbuf = buf = CallocCharBuf(nc * ni); Since we disallow strings with more than 2^31-1 bytes we could test and reject this. It might be more future-proof to change the declaration of int j, ni, nc; to R_xlen_t j, ni, nc; and let the character allocation code reject, but that would create a memory leak since the...
2012 Mar 13
0
111 FIXMEs in main/src
...-- character.c: slen = strlen(ss); /* FIXME -- should handle embedded nuls */ character.c- buf = R_AllocStringBuffer(slen+1, &cbuff); -- character.c: FIXME: could prefer UTF-8 here character.c- */ -- character.c: /* FIXME: could use R_Realloc instead */ character.c- cbuf = CallocCharBuf(strlen(tmp) + 1); -- character.c: /* FIXME use this buffer for new string as well */ character.c- wc = (wchar_t *) -- coerce.c:/* FIXME: Use coerce.c- ===== -- complex.c:/* FIXME: maybe add full IEC60559 support */ complex.c-static double complex clog(double complex x) -- complex.c:/* F...
2007 Oct 03
1
R-2.6.0 is released
...0.16.1. o There is now a global CHARSXP cache, R_StringHash. CHARSXPs are no longer duplicated and must not be modified in place. Developers should strive to only use mkChar (and mkString) for creating new CHARSXPs and avoid use of allocString. A new macro, CallocCharBuf, can be used to obtain a temporary char buffer for manipulating character data. This patch was written by Seth Falcon. o The internal equivalents of as.complex, as.double, as.integer and as.logical used to handle length-1 arguments now accept character string...
2007 Oct 03
1
R-2.6.0 is released
...0.16.1. o There is now a global CHARSXP cache, R_StringHash. CHARSXPs are no longer duplicated and must not be modified in place. Developers should strive to only use mkChar (and mkString) for creating new CHARSXPs and avoid use of allocString. A new macro, CallocCharBuf, can be used to obtain a temporary char buffer for manipulating character data. This patch was written by Seth Falcon. o The internal equivalents of as.complex, as.double, as.integer and as.logical used to handle length-1 arguments now accept character string...