martinzink commented on code in PR #1543:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1543#discussion_r1152260276


##########
libminifi/src/utils/StringUtils.cpp:
##########
@@ -510,4 +510,26 @@ bool StringUtils::matchesSequence(std::string_view str, 
const std::vector<std::s
   return true;
 }
 
+bool StringUtils::splitToUnitAndValue(std::string_view input, std::string& 
unit, int64_t& value) {
+  const char* begin = input.data();
+  char *end;
+  errno = 0;
+  value = std::strtoll(begin, &end, 0);

Review Comment:
   I naively just copied this from timeUtils but looking into it strtoull is 
guranteed to not throw, stoull is the one that throws this only sets the errno.
   But using std::from_chars which doesnt rely on a global error variable is 
probably a better aproach, so I've refactored and added some tests for it in 
https://github.com/apache/nifi-minifi-cpp/pull/1543/commits/471e5dc9ff8473b04d9f801acd4cc9013dbb3db9



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to