Created
January 25, 2012 13:35
-
-
Save ehowe/1676278 to your computer and use it in GitHub Desktop.
This file contains 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
if (RTEST(rf_call(path,is_file,Qnil))) { | |
body = rf_call(path, id_read_file,Qnil); | |
/* I don't wanna deal with non-strings :D. */ | |
if (TYPE(body) != T_STRING) { | |
return -ENOENT; | |
} | |
/* We have the body, now save it the entire contents to our | |
* opened_file lists. */ | |
newfile = ALLOC(opened_file); | |
value = rb_str2cstr(body,&newfile->size); | |
newfile->value = ALLOC_N(char,(newfile->size)+1); | |
memcpy(newfile->value,value,newfile->size); | |
newfile->writesize = newfile->size+1; | |
newfile->path = strdup(path); | |
newfile->raw = 0; | |
newfile->zero_offset = 0; | |
} else |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment