teptris 0.3.27.0-s390x-linux → 0.3.29.0-s390x-linux

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e26a2671daf397fbd732306146f47071bc87cfb0ef93c88862a8928ba65ba92d
4
- data.tar.gz: f8accc3a3e2b1fa723f4dc0ecbf2cdc53239f23bbd718dee94efed0c99c70aef
3
+ metadata.gz: c6e79004c76288e23611f0fd693ee3a2553cf695b7a8c8a57e71e31a7c1a0963
4
+ data.tar.gz: ab1318b3505b9fa5999605fa9079a4f3bb4f107f1f5bb25a4e48efba9a2d6d23
5
5
  SHA512:
6
- metadata.gz: f892225e6b4b6efa302e9056d138fe9db53348fda7ac0b10dd23a48fe53e68784dce7839287f1e07dc5574628ec1d851ebe52fa3d4486854f5cee47637232a11
7
- data.tar.gz: 2583e9030f83c557d31ee5dcafa782bc0e664eb96b76322021689bb8333c141d34f6828335576a0c6607e7b2cda70beeb5d254534e0146ba1a74fde72e73b18d
6
+ metadata.gz: 7f9e6cc2bc1fe7e52f84f9959d37d52a8212828ad20ada257298a602371439f9822ab7076fcc3bb5bbbdf1544f82da0f654f4cbe29032c21338268fa0a7d3b97
7
+ data.tar.gz: 6c667ef4dbe4c6fed85e71b935496d3af5521a8b899f8c7f035562fc5ff7a8370d21503a4f4ea5eade830f91b14a8622420fb004a46ce7d4145a85ac62eab66d
@@ -1,4 +1,4 @@
1
- # libteptris 0.3.27 — vendored source
1
+ # libteptris 0.3.29 — vendored source
2
2
 
3
3
  This directory carries the COMPLETE C source of the engine this
4
4
  gem's extension was built from (the packaging doctrine: compiled
@@ -3,7 +3,7 @@
3
3
 
4
4
  #define TEPTRIS_VERSION_MAJOR 0
5
5
  #define TEPTRIS_VERSION_MINOR 3
6
- #define TEPTRIS_VERSION_PATCH 27
7
- #define TEPTRIS_VERSION_STRING "0.3.27"
6
+ #define TEPTRIS_VERSION_PATCH 29
7
+ #define TEPTRIS_VERSION_STRING "0.3.29"
8
8
 
9
9
  #endif /* TEPTRIS_VERSION_H */
@@ -71,19 +71,27 @@ enum {
71
71
  F_ITAB /* inline table */
72
72
  };
73
73
 
74
+ /* keys ride inline: the op grammar caps a key at 255 bytes, so no
75
+ * key ever needs the heap — the per-key malloc/free pair profiled at
76
+ * ~27% of the writer's flat-dump hot path (2026-11-11) */
77
+ #define W_KEY_INLINE 256
78
+
74
79
  typedef struct wframe {
75
80
  struct wframe *down;
76
81
  int kind;
77
- char *key; /* TBL section component; AOT key; else NULL */
82
+ char *key; /* TBL section component; AOT key; else NULL
83
+ (always points INTO key_buf when set) */
78
84
  size_t key_len;
79
- int first; /* inline separator state */
80
- int saw_subtable; /* TBL: a nested section was opened under us */
85
+ char key_buf[W_KEY_INLINE];
86
+ int first; /* inline separator state */
87
+ int saw_subtable; /* TBL: a nested section was opened under us */
81
88
  } wframe;
82
89
 
83
90
  struct teptris_writer {
84
91
  ebuf out;
85
- char *key; /* pending key */
92
+ char *key; /* pending key (points INTO key_buf when set) */
86
93
  size_t key_len;
94
+ char key_buf[W_KEY_INLINE];
87
95
  wframe *top;
88
96
  int finished;
89
97
  teptris_status st;
@@ -112,67 +120,33 @@ void teptris_writer_free(teptris_writer *w)
112
120
  while (w->top != NULL) {
113
121
  wframe *f = w->top;
114
122
  w->top = f->down;
115
- free(f->key);
116
123
  free(f);
117
124
  }
118
- free(w->key);
119
125
  free(w->out.p);
120
126
  free(w);
121
127
  }
122
128
 
123
129
  static void w_take_key(teptris_writer *w, const char *k, size_t klen)
124
130
  {
125
- free(w->key);
126
- if (klen > 0) {
127
- w->key = malloc(klen);
128
- if (w->key == NULL) {
129
- w->key = NULL;
130
- w->key_len = 0;
131
- w->st = TEPTRIS_ERR_ALLOC;
132
- return;
133
- }
134
- memcpy(w->key, k, klen);
135
- w->key_len = klen;
136
- } else {
137
- /* an empty key stays PENDING: NULL means "no key", and the
138
- * keyed-prefix checks treat NULL as absent. The parse side
139
- * accepts '' = 1, so the writer must emit it ('' via emit_key) */
140
- w->key = malloc(1);
141
- if (w->key == NULL) {
142
- w->key_len = 0;
143
- w->st = TEPTRIS_ERR_ALLOC;
144
- return;
145
- }
146
- w->key[0] = '\0';
147
- w->key_len = 0;
131
+ /* NULL means "no key"; the empty key stays PENDING as a present
132
+ * but zero-length buffer (the parse side accepts '' = 1, so the
133
+ * writer must emit it via emit_key) */
134
+ if (klen >= W_KEY_INLINE) {
135
+ w->st = TEPTRIS_ERR_ARG; /* the grammar caps keys at 255 */
136
+ return;
148
137
  }
138
+ memcpy(w->key_buf, k, klen);
139
+ w->key_buf[klen] = '\0';
140
+ w->key = w->key_buf;
141
+ w->key_len = klen;
149
142
  }
150
143
 
151
144
  static void w_clear_key(teptris_writer *w)
152
145
  {
153
- free(w->key);
154
146
  w->key = NULL;
155
147
  w->key_len = 0;
156
148
  }
157
149
 
158
- /* push with an OWNED key (transfers the malloc from the caller) */
159
- static wframe *w_push_steal(teptris_writer *w, int kind, char *k,
160
- size_t klen)
161
- {
162
- wframe *f = calloc(1, sizeof(*f));
163
- if (f == NULL) {
164
- free(k);
165
- w->st = TEPTRIS_ERR_ALLOC;
166
- return NULL;
167
- }
168
- f->down = w->top;
169
- f->kind = kind;
170
- f->key = k;
171
- f->key_len = klen;
172
- w->top = f;
173
- return f;
174
- }
175
-
176
150
  static wframe *w_push(teptris_writer *w, int kind, const char *k,
177
151
  size_t klen)
178
152
  {
@@ -183,14 +157,10 @@ static wframe *w_push(teptris_writer *w, int kind, const char *k,
183
157
  }
184
158
  f->down = w->top;
185
159
  f->kind = kind;
186
- if (klen > 0) {
187
- f->key = malloc(klen);
188
- if (f->key == NULL) {
189
- free(f);
190
- w->st = TEPTRIS_ERR_ALLOC;
191
- return NULL;
192
- }
193
- memcpy(f->key, k, klen);
160
+ if (k != NULL) {
161
+ memcpy(f->key_buf, k, klen);
162
+ f->key_buf[klen] = '\0';
163
+ f->key = f->key_buf;
194
164
  f->key_len = klen;
195
165
  }
196
166
  w->top = f;
@@ -476,11 +446,11 @@ teptris_status teptris_writer_feed(teptris_writer *w, const uint8_t *ops,
476
446
  eb_c(&w->out, '[');
477
447
  w_path(w, 1);
478
448
  eb_put(&w->out, "]\n", 2);
479
- char *k = w->key; /* frame takes ownership */
449
+ const char *k = w->key;
480
450
  size_t klen = w->key_len;
481
451
  w->key = NULL;
482
452
  w->key_len = 0;
483
- w_push_steal(w, F_TABLE, k, klen);
453
+ w_push(w, F_TABLE, k, klen);
484
454
  break;
485
455
  }
486
456
  case W_BEGIN_AOT: {
@@ -496,11 +466,11 @@ teptris_status teptris_writer_feed(teptris_writer *w, const uint8_t *ops,
496
466
  if (t != NULL) {
497
467
  t->saw_subtable = 1;
498
468
  }
499
- char *k = w->key; /* frame takes ownership */
469
+ const char *k = w->key;
500
470
  size_t klen = w->key_len;
501
471
  w->key = NULL;
502
472
  w->key_len = 0;
503
- w_push_steal(w, F_AOT, k, klen);
473
+ w_push(w, F_AOT, k, klen);
504
474
  break;
505
475
  }
506
476
  case W_BEGIN_ARRAY: {
@@ -567,7 +537,6 @@ teptris_status teptris_writer_feed(teptris_writer *w, const uint8_t *ops,
567
537
  }
568
538
  int kind = f->kind;
569
539
  w->top = f->down;
570
- free(f->key);
571
540
  free(f);
572
541
  if (kind == F_ARRAY) {
573
542
  eb_c(&w->out, ']');
Binary file
Binary file
Binary file
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Teptris
4
- VERSION = "0.3.27.0"
4
+ VERSION = "0.3.29.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teptris
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.27.0
4
+ version: 0.3.29.0
5
5
  platform: s390x-linux
6
6
  authors:
7
7
  - teptris contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-11-09 00:00:00.000000000 Z
11
+ date: 2026-11-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A native C extension over libteptris, a C99 TOML 1.1 parser/emitter.
14
14
  API shape mirrors the tomlib gem.