ccsv_ext 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/ccsv_ext/ccsv_ext.c +8 -5
- data/lib/ccsv_ext/ccsv_ext.bundle +0 -0
- data/lib/ccsv_ext/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b6ecf36f3972b479d1accbac32aa5b7601e09189de26a61aaa49a8573dc5cbd9
|
|
4
|
+
data.tar.gz: e100dee658a5894f0fe80b48cdc969f5cdcb824d4d04b21354ad2141e87146e4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fc5511efb546720d71ad0a0702ef46b4a32a321073ab4d03794dcce6eb47e4f935578d03fd5404a065cf121664cdbe1e36b77ec3567159a53596fa9bd7a30fae
|
|
7
|
+
data.tar.gz: 2a50a21b1c7a45ad886188f548e11fedec8e6e00e225f3cf6d6e643c6242d82db82d4a440aba02bae32876c7b0af0e3e509f40541759aeb78f83a90907bc73f9
|
data/ext/ccsv_ext/ccsv_ext.c
CHANGED
|
@@ -5,13 +5,16 @@ static VALUE rb_cC;
|
|
|
5
5
|
|
|
6
6
|
/* Ccsv.parse_line(string ,delimiter) */
|
|
7
7
|
|
|
8
|
-
#define MAX_INTERVALS 1024
|
|
9
|
-
|
|
10
8
|
static VALUE parse_line(VALUE self, VALUE str, VALUE delimiter) {
|
|
11
9
|
char *line = RSTRING_PTR(str);
|
|
12
10
|
char *delim = RSTRING_PTR(delimiter);
|
|
13
11
|
int len = RSTRING_LEN(str);
|
|
14
|
-
char token
|
|
12
|
+
char *token = (char *) malloc(len + 1);
|
|
13
|
+
VALUE ary = rb_ary_new();
|
|
14
|
+
|
|
15
|
+
/* if token == NULL - exit */
|
|
16
|
+
if (token == NULL)
|
|
17
|
+
return ary;
|
|
15
18
|
|
|
16
19
|
/* chomp! */
|
|
17
20
|
if(line[len] == EOL){
|
|
@@ -20,10 +23,9 @@ static VALUE parse_line(VALUE self, VALUE str, VALUE delimiter) {
|
|
|
20
23
|
line[len] = '\0';
|
|
21
24
|
}
|
|
22
25
|
|
|
23
|
-
VALUE ary = rb_ary_new();
|
|
24
|
-
|
|
25
26
|
/* skip empty line */
|
|
26
27
|
if (len < 2) {
|
|
28
|
+
free(token);
|
|
27
29
|
return ary;
|
|
28
30
|
}
|
|
29
31
|
|
|
@@ -59,6 +61,7 @@ static VALUE parse_line(VALUE self, VALUE str, VALUE delimiter) {
|
|
|
59
61
|
else if (line[i - 1] != EOL)
|
|
60
62
|
rb_ary_push(ary, rb_enc_str_new(&token[0], strlen(&token[0]), rb_utf8_encoding()));
|
|
61
63
|
|
|
64
|
+
free(token);
|
|
62
65
|
rb_ary_dup(ary);
|
|
63
66
|
}
|
|
64
67
|
|
|
Binary file
|
data/lib/ccsv_ext/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ccsv_ext
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sergey Golushko
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-05-
|
|
11
|
+
date: 2019-05-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|