ext/spandx/spandx.c in spandx-0.13.3 vs ext/spandx/spandx.c in spandx-0.13.4

- old
+ new

@@ -1,17 +1,19 @@ #include "spandx.h" +#define NEWLINE 10 + VALUE rb_mSpandx; VALUE rb_mCore; VALUE rb_mCsvParser; // "name","version","license" // "name","version","license"\n // "name","version","license"\r // "name","version","license"\r\n // "name","version",""\r\n -static VALUE parse(VALUE self, VALUE line) +VALUE parse(VALUE self, VALUE line) { if (NIL_P(line)) return Qnil; char *p; @@ -30,16 +32,16 @@ if (state == closed) { s = n; state = open; } else if (state == open) { - if (!*n || n == p || *n == ',' || *n == 10) { + if (!*n || n == p || *n == ',' || *n == NEWLINE) { rb_ary_push(items, rb_str_new(s, p - s)); state = closed; } } } - *p++; + *(p++); } return items; }