Move atoi_n to parse.c

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
This commit is contained in:
Miika Turkia 2017-11-27 20:28:41 +02:00 committed by Dirk Hohndel
parent b3605de93e
commit 8be626d2c1
3 changed files with 15 additions and 13 deletions

View file

@ -12,6 +12,7 @@
#include "gettext.h"
int metric = 1;
int diveid = -1;
/*
static union {
@ -516,3 +517,15 @@ void add_dive_site(char *ds_name, struct dive *dive)
free(to_free);
}
int atoi_n(char *ptr, unsigned int len)
{
if (len < 10) {
char buf[10];
memcpy(buf, ptr, len);
buf[len] = 0;
return atoi(buf);
}
return 0;
}