version_sorter 2.2.2 → 2.2.3

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
- SHA1:
3
- metadata.gz: cdfc29408bf083b0ebb94dba82f7ff2fec8010f5
4
- data.tar.gz: e309afac6537698441953d6d57db4050eb8b6dfd
2
+ SHA256:
3
+ metadata.gz: 2cffc861c5e2a2c13dda17224f8ea4c5e151e158289acb450862dfab2290e349
4
+ data.tar.gz: ac2db605551d166e433f07e7b47096532742d38ed6b1e46ba729a0db49a65fa3
5
5
  SHA512:
6
- metadata.gz: c0a415f37f7710a529835ea1889034d0da366d30af1a72d0a7b9212ccac8cae3dfbc5983df7ab0c2958b4ee0658bb378dc1a8f5f9ace2a0ab3ebd0cea9b24c2a
7
- data.tar.gz: 53ba37e3688ea099930568aaf0c42501976c5ca38e36d6f303e32874ef25837d709930da6df167a0904a7fce9f6c050fc5135bfd52a58b772042788403cab6ca
6
+ metadata.gz: 71a8eb2720fa8f1080b15c672a1ae4180653475ae5b2bc769f6b412290b79c83870de869d0ef297d7597402b507b17ea058980514c866b652ceb2bcc0e6c581f
7
+ data.tar.gz: 7898481b569023fd091a1e0d38dda1effdec20762043b71364cdc1c930bf4e061e1f3c23095481774317e2801e80826ada395c33eff41c06b0dd4a3ee71b0ab5
@@ -15,6 +15,7 @@
15
15
  #include <ruby.h>
16
16
 
17
17
  #define min(a, b) ((a) < (b) ? (a) : (b))
18
+ #define max(a, b) ((a) > (b) ? (a) : (b))
18
19
  typedef int compare_callback_t(const void *, const void *);
19
20
 
20
21
  struct version_number {
@@ -56,7 +57,8 @@ compare_version_number(const struct version_number *a,
56
57
  int cmp = 0;
57
58
 
58
59
  if (num_a) {
59
- cmp = (int)ca->number - (int)cb->number;
60
+ int64_t cmp64 = (int64_t)ca->number - (int64_t)cb->number;
61
+ cmp = (int)max(-1, min(1, cmp64));
60
62
  } else {
61
63
  cmp = strchunk_cmp(
62
64
  a->original, &ca->string,
@@ -237,7 +239,13 @@ rb_version_compare(VALUE rb_self, VALUE rb_version_a, VALUE rb_version_b)
237
239
  {
238
240
  struct version_number *version_a = parse_version_number(StringValueCStr(rb_version_a));
239
241
  struct version_number *version_b = parse_version_number(StringValueCStr(rb_version_b));
240
- return INT2NUM(version_compare_cb(&version_a, &version_b));
242
+
243
+ VALUE result = INT2NUM(version_compare_cb(&version_a, &version_b));
244
+
245
+ xfree(version_a);
246
+ xfree(version_b);
247
+
248
+ return result;
241
249
  }
242
250
 
243
251
  void Init_version_sorter(void)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: version_sorter
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Wanstrath
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-01-29 00:00:00.000000000 Z
12
+ date: 2018-02-07 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: VersionSorter is a C extension that does fast sorting of large sets of
15
15
  version strings.
@@ -42,7 +42,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
42
42
  version: '0'
43
43
  requirements: []
44
44
  rubyforge_project:
45
- rubygems_version: 2.5.2
45
+ rubygems_version: 2.7.3
46
46
  signing_key:
47
47
  specification_version: 4
48
48
  summary: Fast sorting of version strings