From 59214ba395d402fbe8fa20c42571732139e5dbc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20M=C3=BCller?= Date: Fri, 5 Apr 2024 20:04:13 -0700 Subject: [PATCH] Keep original readline buffer sizes When we create a Readline "context" object we heap allocate buffers that libreadline requires. So far we have specified our own buffer sizes, independent of libreadline's defaults. But there really is no good reason not to go with whatever they were using from the get-go. Thus, with this change we just allocate as many bytes as libreadline would by default. --- src/lib.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 85045912..66a64cbf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -250,10 +250,8 @@ impl Readline { // allocated by libreadline itself, as part of its // initialization. Because we create a new context we need to // reinitialize this data. - rl_line_buffer = calloc(1, 64).cast(); - rl_line_buffer_len = 64; - rl_executing_keyseq = calloc(1, 16).cast(); - rl_key_sequence_length = 16; + rl_line_buffer = calloc(1, rl_line_buffer_len as _).cast(); + rl_executing_keyseq = calloc(1, rl_key_sequence_length as _).cast(); // We use similar behavior to default Rust and panic on // allocation failure.