parser: move atoi_n to import-divinglog.cpp

That was the only user of this helper function, so move it there.
Moreover, impelement it with the standard function std::from_chars
instead of copying the string.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-06-17 21:46:17 +02:00 committed by bstoeger
parent 541abf7ae4
commit 124362caa5
3 changed files with 9 additions and 13 deletions

View file

@ -16,6 +16,15 @@
#include "membuffer.h"
#include "gettext.h"
#include <charconv>
static int atoi_n(const char *ptr, size_t len)
{
int res = 0;
std::from_chars(ptr, ptr + len, res);
return res;
}
static int divinglog_cylinder(void *param, int, char **data, char **)
{
struct parser_state *state = (struct parser_state *)param;