rbs 3.5.0 → 3.5.1.pre.1

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
  SHA256:
3
- metadata.gz: 1b76067316b4cfcc66b0072df88be6f74b1e982c3e2c583aa81153fc1d7590cf
4
- data.tar.gz: 1051d0012adab3eb36807bad04223e2f6aee7e242981ff12ad0f5e7bdab910d9
3
+ metadata.gz: 15842c05830277f680d570af8724cfe962c63c1188e125b899904d43633a013c
4
+ data.tar.gz: 4676d5718267865fb19c432a15769c1b8a0f1ca41efc28da0be3fec59abc8fc7
5
5
  SHA512:
6
- metadata.gz: cb7c0b36f6398e989fb33cac75b76566404004c54bc395d2e320c01ec50022a6dd9161589506d2446ec71e4f64bebc983a2664acefc8b64a5bbef1832ee86191
7
- data.tar.gz: fc53b27131a5b9d947c072b809aff22c23edadbbe211f49ce415796dc0d3f084230f6c609b1eaf1229adf4a15acce1f67aa57bc9ec0929989c9f085155f8c272
6
+ metadata.gz: 2d23e68eb43cdc67695fb289a052c0580be90859211fca4580497dea2ad9a88ad76730a74c054d54ccfd0805a3b49032db611af1c66739f36b6ea2b1a82e7bc0
7
+ data.tar.gz: a0f1246404e79a4b7e49f56d460edc57271846249ee5fc0548525727e4850f2c0cdd733e06a5034ddff4af3f1ea0e226880efe68f4000f19406073365f87a8fc
@@ -2,6 +2,7 @@
2
2
 
3
3
  #define RBS_LOC_REQUIRED_P(loc, i) ((loc)->children->required_p & (1 << (i)))
4
4
  #define RBS_LOC_OPTIONAL_P(loc, i) (!RBS_LOC_REQUIRED_P((loc), (i)))
5
+ #define RBS_LOC_CHILDREN_SIZE(cap) (sizeof(rbs_loc_children) + sizeof(rbs_loc_entry) * ((cap) - 1))
5
6
 
6
7
  VALUE RBS_Location;
7
8
 
@@ -25,7 +26,7 @@ static void check_children_max(unsigned short n) {
25
26
  void rbs_loc_alloc_children(rbs_loc *loc, unsigned short cap) {
26
27
  check_children_max(cap);
27
28
 
28
- size_t s = sizeof(rbs_loc_children) + sizeof(rbs_loc_entry) * cap;
29
+ size_t s = RBS_LOC_CHILDREN_SIZE(cap);
29
30
  loc->children = malloc(s);
30
31
 
31
32
  loc->children->len = 0;
@@ -39,7 +40,7 @@ static void check_children_cap(rbs_loc *loc) {
39
40
  } else {
40
41
  if (loc->children->len == loc->children->cap) {
41
42
  check_children_max(loc->children->cap + 1);
42
- size_t s = sizeof(rbs_loc_children) + sizeof(rbs_loc_entry) * (++loc->children->cap);
43
+ size_t s = RBS_LOC_CHILDREN_SIZE(++loc->children->cap);
43
44
  loc->children = realloc(loc->children, s);
44
45
  }
45
46
  }
@@ -85,7 +86,7 @@ static size_t rbs_loc_memsize(const void *ptr) {
85
86
  if (loc->children == NULL) {
86
87
  return sizeof(rbs_loc);
87
88
  } else {
88
- return sizeof(rbs_loc) + sizeof(rbs_loc_children) + sizeof(rbs_loc_entry) * loc->children->cap;
89
+ return sizeof(rbs_loc) + RBS_LOC_CHILDREN_SIZE(loc->children->cap);
89
90
  }
90
91
  }
91
92
 
@@ -129,7 +130,7 @@ static VALUE location_initialize_copy(VALUE self, VALUE other) {
129
130
  self_loc->rg = other_loc->rg;
130
131
  if (other_loc->children != NULL) {
131
132
  rbs_loc_alloc_children(self_loc, other_loc->children->cap);
132
- memcpy(self_loc->children, other_loc->children, sizeof(rbs_loc_children) + sizeof(rbs_loc_entry) * other_loc->children->cap);
133
+ memcpy(self_loc->children, other_loc->children, RBS_LOC_CHILDREN_SIZE(other_loc->children->cap));
133
134
  }
134
135
 
135
136
  return Qnil;
@@ -16,17 +16,19 @@ typedef struct {
16
16
 
17
17
  typedef unsigned int rbs_loc_entry_bitmap;
18
18
 
19
+ // The flexible array always allocates, but it's okay.
20
+ // This struct is not allocated when the `rbs_loc` doesn't have children.
19
21
  typedef struct {
20
22
  unsigned short len;
21
23
  unsigned short cap;
22
24
  rbs_loc_entry_bitmap required_p;
23
- rbs_loc_entry entries[0];
25
+ rbs_loc_entry entries[1];
24
26
  } rbs_loc_children;
25
27
 
26
28
  typedef struct {
27
29
  VALUE buffer;
28
30
  range rg;
29
- rbs_loc_children *children;
31
+ rbs_loc_children *children; // NULL when no children is allocated
30
32
  } rbs_loc;
31
33
 
32
34
  /**
data/lib/rbs/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RBS
4
- VERSION = "3.5.0"
4
+ VERSION = "3.5.1.pre.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbs
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.0
4
+ version: 3.5.1.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-06 00:00:00.000000000 Z
11
+ date: 2024-06-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: RBS is the language for type signatures for Ruby and standard library
14
14
  definitions.
@@ -513,7 +513,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
513
513
  - !ruby/object:Gem::Version
514
514
  version: '0'
515
515
  requirements: []
516
- rubygems_version: 3.5.9
516
+ rubygems_version: 3.5.3
517
517
  signing_key:
518
518
  specification_version: 4
519
519
  summary: Type signature for Ruby.