summaryrefslogtreecommitdiff
path: root/prism
diff options
context:
space:
mode:
authorKevin Menard <kevin@nirvdrum.com>2024-02-13 01:25:54 -0500
committergit <svn-admin@ruby-lang.org>2024-03-08 18:48:54 +0000
commitd473256abe51dee41ae5b3c877c5773a9b65ee86 (patch)
tree7d4f58075929d1d8a8d670379590a7e6fd215d52 /prism
parent82fb6a90d5cf5081df11ebed6cfc623159f72676 (diff)
[ruby/prism] Extract a magic value to a named constant.
https://github.com/ruby/prism/commit/54d14a35a9
Diffstat (limited to 'prism')
-rw-r--r--prism/prism.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/prism/prism.c b/prism/prism.c
index 6e4de22ec1..2b1d35588d 100644
--- a/prism/prism.c
+++ b/prism/prism.c
@@ -14,6 +14,8 @@ pm_version(void) {
*/
#define PM_TAB_WHITESPACE_SIZE 8
+#define PM_DEFAULT_BUFFER_SIZE_BYTES 16
+
#ifndef PM_DEBUG_LOGGING
/**
* Debugging logging will provide you with additional debugging functions as
@@ -8875,8 +8877,8 @@ static void
pm_token_buffer_escape(pm_parser_t *parser, pm_token_buffer_t *token_buffer) {
const uint8_t *start;
if (token_buffer->cursor == NULL) {
- pm_buffer_init_capacity(&token_buffer->buffer, 16);
- pm_buffer_init_capacity(&token_buffer->regular_expression_buffer, 16);
+ pm_buffer_init_capacity(&token_buffer->buffer, PM_DEFAULT_BUFFER_SIZE_BYTES);
+ pm_buffer_init_capacity(&token_buffer->regular_expression_buffer, PM_DEFAULT_BUFFER_SIZE_BYTES);
start = parser->current.start;
} else {
start = token_buffer->cursor;