From 379aa8c2675afa53a47be2422d5c3db639efa02f Mon Sep 17 00:00:00 2001 From: Ruben Zwietering Date: Tue, 13 Aug 2024 21:32:25 +0200 Subject: [PATCH] Use line.reserve in sdobj_ReadFile instead of constructor Passing a count parameter to the vector constructor does not reserve count elements but instead fills the vector with count elements. This caused the endianness check to fail first because the first 256 characters were null bytes. --- src/link/sdas_obj.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/link/sdas_obj.cpp b/src/link/sdas_obj.cpp index 2d609e23..cb195ed6 100644 --- a/src/link/sdas_obj.cpp +++ b/src/link/sdas_obj.cpp @@ -136,7 +136,8 @@ enum RelocFlags { }; void sdobj_ReadFile(FileStackNode const &where, FILE *file, std::vector &fileSymbols) { - std::vector line(256); + std::vector line; + line.reserve(256); char const *token; #define getToken(ptr, ...) \