Created
June 2, 2009 17:24
-
-
Save methodmissing/122375 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| VALUE | |
| rb_str_buf_new(capa) | |
| long capa; | |
| { | |
| VALUE str = str_alloc(rb_cString); | |
| if (capa < STR_BUF_MIN_SIZE) { | |
| capa = STR_BUF_MIN_SIZE; | |
| } | |
| RSTRING(str)->ptr = 0; | |
| RSTRING(str)->len = 0; | |
| RSTRING(str)->aux.capa = capa; | |
| RSTRING(str)->ptr = ALLOC_N(char, capa+1); | |
| RSTRING(str)->ptr[0] = '\0'; | |
| return str; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment