slim-attributes 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/ext/slim_attrib_ext.c +8 -0
  2. metadata +40 -33
@@ -63,8 +63,15 @@ static VALUE all_hashes(VALUE obj) {
63
63
  lengths = mysql_fetch_lengths(res);
64
64
  for (s=j=0; j < nf; j++) s += lengths[j]; // s = total of lengths
65
65
  pointers_space = ruby_xmalloc((nf + 1) * sizeof(char *) + s); // space for data pointers & data
66
+ if (!pointers_space) {
67
+ rb_raise(rb_eNoMemError, "out of memory");
68
+ }
66
69
  p = *pointers_space = (char *)(pointers_space + nf + 1); // pointer to first data item
67
70
  row_info_space = ruby_xcalloc(nf, 1); // space for flags for each column in this row
71
+ if (!row_info_space) {
72
+ ruby_xfree(pointers_space);
73
+ rb_raise(rb_eNoMemError, "out of memory");
74
+ }
68
75
  for (j=0; j < nf; j++) {
69
76
  len = (unsigned int)lengths[j];
70
77
  if (len) {
@@ -154,6 +161,7 @@ static VALUE dup(VALUE obj) {
154
161
 
155
162
  nf = RHASH(field_indexes)->tbl->num_entries;
156
163
  row_info_space = ruby_xmalloc(nf); // dup needs its own set of flags
164
+ if (!row_info_space) rb_raise(rb_eNoMemError, "out of memory");
157
165
  memcpy(row_info_space, GetCharPtr(rb_ivar_get(obj, row_info_id)), nf);
158
166
  for (i=0; i < nf; i++) row_info_space[i] &= ~SLIM_IS_SET; // remove any set flags
159
167
  frh = rb_class_new_instance(0, NULL, cRowHash); // make the new row data object
metadata CHANGED
@@ -1,50 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.4
3
- specification_version: 1
4
2
  name: slim-attributes
5
3
  version: !ruby/object:Gem::Version
6
- version: 0.5.0
7
- date: 2008-10-14 00:00:00 +03:00
8
- summary: Slim attributes boosts speed in Rails/Mysql ActiveRecord Models by avoiding instantiating Hashes for each result row, and lazily instantiating attributes as needed
9
- require_paths:
10
- - lib
11
- email: sdsykes@gmail.com
12
- homepage: http://slim-attributes.rubyforge.org/
13
- rubyforge_project: slim-attributes
14
- description:
15
- autorequire: slim
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: false
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
4
+ version: 0.6.0
25
5
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
6
  authors:
30
7
  - Stephen Sykes
8
+ autorequire: slim
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-04-06 00:00:00 +03:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description:
17
+ email: sdsykes@gmail.com
18
+ executables: []
19
+
20
+ extensions:
21
+ - ext/extconf.rb
22
+ extra_rdoc_files: []
23
+
31
24
  files:
32
25
  - lib/slim_attributes.rb
33
26
  - ext/extconf.rb
34
27
  - ext/slim_attrib_ext.c
35
28
  - README
36
29
  - MIT_LICENCE
37
- test_files: []
38
-
30
+ has_rdoc: false
31
+ homepage: http://slim-attributes.rubyforge.org/
32
+ post_install_message:
39
33
  rdoc_options: []
40
34
 
41
- extra_rdoc_files: []
42
-
43
- executables: []
44
-
45
- extensions:
46
- - ext/extconf.rb
35
+ require_paths:
36
+ - lib
37
+ required_ruby_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: "0"
42
+ version:
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: "0"
48
+ version:
47
49
  requirements: []
48
50
 
49
- dependencies: []
51
+ rubyforge_project: slim-attributes
52
+ rubygems_version: 1.3.1
53
+ signing_key:
54
+ specification_version: 2
55
+ summary: Slim attributes boosts speed in Rails/Mysql ActiveRecord Models by avoiding instantiating Hashes for each result row, and lazily instantiating attributes as needed
56
+ test_files: []
50
57