inmemory_kv 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ee6413bdf95e2e902b4abb882e72284a8742c7bc
4
- data.tar.gz: cdc96cbf5654abbd99aa4a263271e8a29e12c374
3
+ metadata.gz: ffaeeb79dd57e1fc012e9b238ed9a519100ebc71
4
+ data.tar.gz: 50294e8cf9bbcc2a9b77438bf1b2b0c801c713f4
5
5
  SHA512:
6
- metadata.gz: b442b6dabd287018b2e519d98eb182340f9e5653f6bc31f973492a965af6be7d4c3dc9324e5353efef71d42f42602f4b383da804cdb19f0504664dedcfac5883
7
- data.tar.gz: 1826699cf819121d272488f187dd05367ca85db0944ff9b2ab7eecb95a3771a37cace4e895c4b82afaf1186aec7bbd4ef3063c3a583be8655423ae826023e17f
6
+ metadata.gz: 654cc28b96bf064a196bcfd919101a0a4e539957d6ea075f318f973ecb21a65b71a0bf14b400dfdcf2b7e503b8582cc0e43da60ada4506d7fc711bc6c68839ed
7
+ data.tar.gz: a257f796ceafbcc2f9c9a5a076047a7286a6fce77f96777da953bd5f6ddd42242c3108b2280942774f27e34620bd88c816bc1d282db38e7e033569cf3bcd7889
@@ -402,16 +402,19 @@ kv_insert(inmemory_kv *kv, const char* key, u32 key_size, const char* val, u32 v
402
402
  }
403
403
  if (item == NULL) {
404
404
  u32 new_size = item_need_size(key_size, val_size);
405
- #ifdef HAVE_MALLOC_USABLE_SIZE
405
+ #ifndef HAVE_MALLOC_USABLE_SIZE
406
+ new_size = (new_size + 7) & 7;
407
+ #endif
406
408
  item = malloc(new_size);
407
- if (item == NULL)
409
+ if (item == NULL) {
410
+ if (old_item == NULL) {
411
+ hash_delete(&kv->tab, pos);
412
+ }
408
413
  return NULL;
414
+ }
415
+ #ifdef HAVE_MALLOC_USABLE_SIZE
409
416
  new_size = malloc_usable_size(item);
410
417
  #else
411
- new_size = (new_size + 7) & 7;
412
- item = malloc(new_size);
413
- if (item == NULL)
414
- return NULL;
415
418
  item->item_size = new_size;
416
419
  #endif
417
420
  if (old_item != NULL) {
@@ -1,3 +1,3 @@
1
1
  module InMemoryKV
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inmemory_kv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sokolov Yura aka funny_falcon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-05 00:00:00.000000000 Z
11
+ date: 2015-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -93,10 +93,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  version: '0'
94
94
  requirements: []
95
95
  rubyforge_project:
96
- rubygems_version: 2.4.4
96
+ rubygems_version: 2.4.3
97
97
  signing_key:
98
98
  specification_version: 4
99
99
  summary: Simple in memory string/string hash without GC presure
100
100
  test_files:
101
101
  - test/test_str2str.rb
102
- has_rdoc: