From 2d96a01bb2234e37c501029dc7a81943aaa0bfb7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 2 Mar 2021 11:03:51 -0500 Subject: [PATCH] use trim functions in utils to remove whitespace and comments --- src/molecule.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/molecule.cpp b/src/molecule.cpp index c10cd79754..a1884cb9b7 100644 --- a/src/molecule.cpp +++ b/src/molecule.cpp @@ -411,15 +411,14 @@ void Molecule::read(int flag) readline(line); - // trim anything from '#' onward - // if line is blank, continue + // trim comments. if line is blank, continue - if ((ptr = strchr(line,'#'))) *ptr = '\0'; - if (strspn(line," \t\n\r") == strlen(line)) continue; + auto text = utils::trim(utils::trim_comment(line)); + if (text.empty()) continue; // search line for header keywords and set corresponding variable try { - ValueTokenizer values(line); + ValueTokenizer values(text); int nmatch = values.count(); int nwant = 0;