chunkio 0.1.4 → 0.1.5
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/chunkio/chunkio.h +4 -13
- data/ext/chunkio/chunkio_chunk.c +15 -5
- data/ext/chunkio/chunkio_stream.c +0 -1
- data/lib/chunkio/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 230de38a2734b474235db25f5d470783aeda36489e0a0f1fae42f25f360541ee
|
4
|
+
data.tar.gz: ee656bc59c3569a1790dae2a1e46c7f2a7e21b675d728956183cf12ff126f774
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f3e0a1739be527f0a730ed3d908bc23807d49797e89ec62fda5227c3199f203021d853fd1776c1ea252b1b01ba9b6fbe5f0942c50f70bc4911bb927f1443846
|
7
|
+
data.tar.gz: 855dce6c8e2a8aaea5dee11516ad60445a107811d76e99c7c86d4fd02dff87ed2f867ff1db5cad9aa740d6492ad34c659bf7d185500df814301e701299ef25de
|
data/ext/chunkio/chunkio.h
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
#include <chunkio/chunkio.h>
|
6
6
|
#include <chunkio/cio_meta.h>
|
7
7
|
|
8
|
-
typedef struct
|
8
|
+
typedef struct chunkio_chunk_type {
|
9
9
|
struct cio_chunk* inner;
|
10
10
|
int closed;
|
11
11
|
int sync_mode; /* 0 is false, 1 is true */
|
@@ -20,30 +20,21 @@ static const rb_data_type_t chunkio_context_type =
|
|
20
20
|
{
|
21
21
|
"ChunkIO::Context",
|
22
22
|
{0, (void (*)(void *))chunkio_context_free, 0,},
|
23
|
-
0, 0,
|
24
|
-
#ifdef RUBY_TYPED_FREE_IMMEDIATELY
|
25
|
-
RUBY_TYPED_FREE_IMMEDIATELY,
|
26
|
-
#endif
|
23
|
+
0, 0, 0
|
27
24
|
};
|
28
25
|
|
29
26
|
static const rb_data_type_t chunkio_stream_type =
|
30
27
|
{
|
31
28
|
"ChunkIO::Stream",
|
32
29
|
{0, (void (*)(void *))chunkio_stream_free, 0,},
|
33
|
-
0, 0,
|
34
|
-
#ifdef RUBY_TYPED_FREE_IMMEDIATELY
|
35
|
-
RUBY_TYPED_FREE_IMMEDIATELY,
|
36
|
-
#endif
|
30
|
+
0, 0, 0
|
37
31
|
};
|
38
32
|
|
39
33
|
static const rb_data_type_t chunkio_chunk_type =
|
40
34
|
{
|
41
35
|
"ChunkIO::Chunk",
|
42
36
|
{0, (void (*)(void *))chunkio_chunk_free, 0,}, /* TODO free ch->name and ch->head */
|
43
|
-
0, 0,
|
44
|
-
#ifdef RUBY_TYPED_FREE_IMMEDIATELY
|
45
|
-
RUBY_TYPED_FREE_IMMEDIATELY,
|
46
|
-
#endif
|
37
|
+
0, 0, 0
|
47
38
|
};
|
48
39
|
|
49
40
|
struct cio_ctx *UnwrapChunkIOContext(VALUE self);
|
data/ext/chunkio/chunkio_chunk.c
CHANGED
@@ -6,24 +6,34 @@ void *chunkio_chunk_free(chunkio_chunk *ch)
|
|
6
6
|
{
|
7
7
|
if (ch->inner != NULL) {
|
8
8
|
/*
|
9
|
-
cio_stream can be freed before this line.
|
10
|
-
but cio_chunk_close and cio_chunk_sync needs
|
9
|
+
`cio_stream` and `cio_ctx` can be freed before this line.
|
10
|
+
but cio_chunk_close and cio_chunk_sync needs them during freeing itself.
|
11
11
|
So creating dummy object to work correctly.
|
12
|
-
|
12
|
+
*/
|
13
13
|
struct cio_stream st;
|
14
14
|
st.type = CIO_STORE_FS;
|
15
|
+
st.name = (char *)"stream";
|
15
16
|
ch->inner->st = &st;
|
17
|
+
|
18
|
+
struct cio_ctx ct;
|
19
|
+
ct.flags = CIO_CHECKSUM;
|
20
|
+
ct.log_cb = NULL;
|
21
|
+
ch->inner->ctx = &ct;
|
22
|
+
|
16
23
|
cio_chunk_sync(ch->inner);
|
17
24
|
cio_chunk_close(ch->inner, CIO_FALSE);
|
18
25
|
ch->inner = NULL;
|
19
26
|
}
|
20
27
|
|
21
|
-
|
28
|
+
if (ch != NULL) {
|
29
|
+
xfree(ch);
|
30
|
+
ch = NULL;
|
31
|
+
}
|
22
32
|
}
|
23
33
|
|
24
34
|
static VALUE chunkio_chunk_allocate_context(VALUE klass)
|
25
35
|
{
|
26
|
-
chunkio_chunk *c = (chunkio_chunk *)xmalloc(sizeof(
|
36
|
+
chunkio_chunk *c = (chunkio_chunk *)xmalloc(sizeof(struct chunkio_chunk_type));
|
27
37
|
c->inner = NULL;
|
28
38
|
c->closed = 0;
|
29
39
|
c->sync_mode = 0;
|
data/lib/chunkio/version.rb
CHANGED