mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Move atoi_n to parse.c
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
This commit is contained in:
parent
b3605de93e
commit
8be626d2c1
3 changed files with 15 additions and 13 deletions
13
core/parse.c
13
core/parse.c
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue