@@ -149,7 +149,7 @@ void Dotenv::ParseContent(const std::string_view input) {
149149 if (newline != std::string_view::npos) {
150150 content.remove_prefix (newline + 1 );
151151 } else {
152- content. remove_prefix (content. size ()) ;
152+ content = {} ;
153153 }
154154 continue ;
155155 }
@@ -203,7 +203,7 @@ void Dotenv::ParseContent(const std::string_view input) {
203203 if (newline != std::string_view::npos) {
204204 content.remove_prefix (newline + 1 );
205205 } else {
206- content. remove_prefix (content. size ()) ;
206+ content = {} ;
207207 }
208208 continue ;
209209 }
@@ -236,7 +236,7 @@ void Dotenv::ParseContent(const std::string_view input) {
236236 if (newline != std::string_view::npos) {
237237 content.remove_prefix (newline + 1 );
238238 } else {
239- content. remove_prefix (content. size ()) ;
239+ content = {} ;
240240 }
241241 continue ;
242242 }
@@ -254,8 +254,7 @@ void Dotenv::ParseContent(const std::string_view input) {
254254 if (hash_character != std::string_view::npos) {
255255 value = content.substr (0 , hash_character);
256256 }
257- value = trim_spaces (value);
258- store_.insert_or_assign (std::string (key), value);
257+ store_.insert_or_assign (std::string (key), trim_spaces (value));
259258 content.remove_prefix (newline + 1 );
260259 } else {
261260 // In case the last line is a single key/value pair
@@ -265,14 +264,11 @@ void Dotenv::ParseContent(const std::string_view input) {
265264 if (hash_char != std::string_view::npos) {
266265 value = content.substr (0 , hash_char);
267266 }
268- value = trim_spaces (value);
269-
270- store_.insert_or_assign (std::string (key), value);
271- content.remove_prefix (content.size ());
267+ store_.insert_or_assign (std::string (key), trim_spaces (value));
268+ content = {};
272269 }
273270
274- value = trim_spaces (value);
275- store_.insert_or_assign (std::string (key), value);
271+ store_.insert_or_assign (std::string (key), trim_spaces (value));
276272 }
277273 }
278274}
0 commit comments