hiredis 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -179,6 +179,7 @@ static VALUE connection_disconnect(VALUE self) {
179
179
  static VALUE connection_write(VALUE self, VALUE command) {
180
180
  redisParentContext *pc;
181
181
  int argc;
182
+ VALUE *args;
182
183
  char **argv = NULL;
183
184
  size_t *alen = NULL;
184
185
  int i;
@@ -193,12 +194,15 @@ static VALUE connection_write(VALUE self, VALUE command) {
193
194
  rb_raise(rb_eRuntimeError,"%s","not connected");
194
195
 
195
196
  argc = (int)RARRAY_LEN(command);
197
+ args = RARRAY_PTR(command);
196
198
  argv = malloc(argc*sizeof(char*));
197
199
  alen = malloc(argc*sizeof(size_t));
198
200
  for (i = 0; i < argc; i++) {
199
- VALUE arg = rb_obj_as_string(RARRAY_PTR(command)[i]);
200
- argv[i] = RSTRING_PTR(arg);
201
- alen[i] = RSTRING_LEN(arg);
201
+ /* Replace arguments in the arguments array to prevent their string
202
+ * equivalents to be garbage collected before this loop is done. */
203
+ args[i] = rb_obj_as_string(args[i]);
204
+ argv[i] = RSTRING_PTR(args[i]);
205
+ alen[i] = RSTRING_LEN(args[i]);
202
206
  }
203
207
  redisAppendCommandArgv(pc->context,argc,(const char**)argv,alen);
204
208
  free(argv);
@@ -1,3 +1,3 @@
1
1
  module Hiredis
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiredis
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
5
- prerelease:
4
+ prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 3
9
- - 0
10
- version: 0.3.0
8
+ - 1
9
+ version: 0.3.1
11
10
  platform: ruby
12
11
  authors:
13
12
  - Pieter Noordhuis
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2011-02-04 00:00:00 +01:00
17
+ date: 2011-02-07 00:00:00 +01:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
@@ -26,7 +25,6 @@ dependencies:
26
25
  requirements:
27
26
  - - ~>
28
27
  - !ruby/object:Gem::Version
29
- hash: 1
30
28
  segments:
31
29
  - 0
32
30
  - 7
@@ -88,7 +86,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
88
86
  requirements:
89
87
  - - ">="
90
88
  - !ruby/object:Gem::Version
91
- hash: 3
92
89
  segments:
93
90
  - 0
94
91
  version: "0"
@@ -97,14 +94,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
94
  requirements:
98
95
  - - ">="
99
96
  - !ruby/object:Gem::Version
100
- hash: 3
101
97
  segments:
102
98
  - 0
103
99
  version: "0"
104
100
  requirements: []
105
101
 
106
102
  rubyforge_project:
107
- rubygems_version: 1.5.0
103
+ rubygems_version: 1.3.7
108
104
  signing_key:
109
105
  specification_version: 3
110
106
  summary: Ruby extension that wraps Hiredis (blocking connection and reply parsing)