ext/ccsv.c in ccsv-0.1 vs ext/ccsv.c in ccsv-0.1.1
- old
+ new
@@ -5,35 +5,35 @@
static VALUE foreach(VALUE self, VALUE filename) {
FILE *file = fopen(StringValueCStr(filename), "r");
if (file == NULL)
rb_raise(rb_eRuntimeError, "File not found");
-
+
char line[MAX_LENGTH];
char *token;
int idx;
VALUE ary;
-
+
while (fgets(line, sizeof(line), file) != NULL) {
ary = rb_ary_new();
token = strtok(line, DELIMITERS);
idx = 0;
-
+
while (token != NULL) {
rb_ary_store(ary, idx, rb_str_new(token, strlen(token)));
idx ++;
token = strtok(NULL, DELIMITERS);
}
-
+
/* OBJ_FREEZE(ary); */
rb_yield(ary);
/* FL_UNSET((ary), FL_FREEZE); */
-
+
/* for(idx = 0; idx < RARRAY_LEN(ary); idx ++) {
rb_ary_store(ary, idx, Qnil);
- } */
-
+ } */
+
}
fclose(file);
return Qnil;