berns 4.1.1 → 4.2.0

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: c6e746c49f8701090aa423558ef9ccc644cff448b9c9c4f0c55e2752fda3ccf6
4
- data.tar.gz: 9cb5b7761c29041c95b0ae9e00b4d98f8bffc06130bd02f9d3e4cecec31bc310
3
+ metadata.gz: c4a8fe33f6e2f7e69c6d02de7eb682b9b0eb7b41799b911e4579284b7d758255
4
+ data.tar.gz: 3e4571f154a5a1bceef2502642dbf42dbfd12e7daf2f6fa8183fdda45598088c
5
5
  SHA512:
6
- metadata.gz: 465a227cbce7038041f4faf90a976fdd2d04a0833f140acf9c3aa26f74d6a9439155aa4bf15fbd78801aefc3b5fa88f7de11b248817e7e3ce83efc5983d9330e
7
- data.tar.gz: e33fb6252cd1ab022d7543fb0275d2e1dc3e13fd1c966bb53ca3b806029d3b498212137995597910f6382bc036d4e22c322892732ca8a65ab49bc37b917451c7
6
+ metadata.gz: ac43b2a7659ba8806dff8d7457b175632dbd38f75d771acd3f6bf4e97c3974de031a88334d95248f98ce71d2ebf0b761c65bc33856df0beb3cb5f874a604b36e
7
+ data.tar.gz: f70c88f8dd2f4c3d06f84748d54536f066f19a4d77d4e27c6fa70121a4b49a04fbf94ea27c87e9fbe9340b9e6ae8a2384c1378644c4f300561b1ff4a13ce69c4
data/ext/berns/berns.c CHANGED
@@ -173,9 +173,9 @@ static VALUE external_escape_html(RB_UNUSED_VAR(VALUE self), VALUE string) {
173
173
  /*
174
174
  * Return a freeable piece of memory with a copy of the attribute passed in it.
175
175
  * Why does this exist? So we can free the memory created by this without having
176
- * branch further in other places.
176
+ * to branch further in other places.
177
177
  */
178
- static char * empty_value_to_attribute(const char *attr, const size_t attrlen) {
178
+ static inline char * empty_value_to_attribute(const char *attr, const size_t attrlen) {
179
179
  size_t total_size = attrlen + 1;
180
180
  char *dest = malloc(total_size);
181
181
  char *end = dest + total_size;
@@ -465,6 +465,9 @@ static VALUE external_to_attributes(RB_UNUSED_VAR(VALUE self), VALUE attributes)
465
465
  return rstring;
466
466
  }
467
467
 
468
+ /*
469
+ * Create a void element i.e. one without children/content.
470
+ */
468
471
  static char * void_element(const char *tag, size_t tlen, VALUE attributes) {
469
472
  const char *empty = "";
470
473
  char *attrs = hash_value_to_attribute(empty, 0, attributes);
@@ -491,6 +494,8 @@ static char * void_element(const char *tag, size_t tlen, VALUE attributes) {
491
494
 
492
495
  ptr = stecpy(ptr, tag_close, end);
493
496
 
497
+ free(attrs);
498
+
494
499
  return dest;
495
500
  }
496
501
 
Binary file
data/lib/berns/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Berns
3
- VERSION = '4.1.1'
3
+ VERSION = '4.2.0'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: berns
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.1
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taylor Beck
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-09-01 00:00:00.000000000 Z
12
+ date: 2022-12-01 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A utility library for generating HTML strings.
15
15
  email: