From cb7cd1ac672c1195c2762d8d68972a2636f93a39 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Sat, 13 Jun 2020 18:53:28 +0200 Subject: [PATCH] Simplify code --- m-serial-bin.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/m-serial-bin.h b/m-serial-bin.h index 01f6184e..701615a0 100644 --- a/m-serial-bin.h +++ b/m-serial-bin.h @@ -415,8 +415,7 @@ m_serial_bin_read_string(m_serial_read_t serial, struct string_s *s){ size_t length; if (m_serial_bin_read_size(f, &length) != true) return M_SERIAL_FAIL; // Use of internal string interface to dimension the string - string_reserve(s, length + 1); - char *p = stringi_get_str(s); + char *p = stringi_fit2size(s, length + 1); stringi_set_size(s, length); // Read the characters excluding the final null one. // NOTE: fread supports length == 0.