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
|
@ -29,7 +29,6 @@
|
||||||
|
|
||||||
int verbose, quit, force_root;
|
int verbose, quit, force_root;
|
||||||
int last_xml_version = -1;
|
int last_xml_version = -1;
|
||||||
int diveid = -1;
|
|
||||||
|
|
||||||
static xmlDoc *test_xslt_transforms(xmlDoc *doc, const char **params);
|
static xmlDoc *test_xslt_transforms(xmlDoc *doc, const char **params);
|
||||||
|
|
||||||
|
@ -1886,18 +1885,6 @@ extern int divinglog_cylinder(void *handle, int columns, char **data, char **col
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern int divinglog_profile(void *handle, int columns, char **data, char **column)
|
extern int divinglog_profile(void *handle, int columns, char **data, char **column)
|
||||||
{
|
{
|
||||||
(void) handle;
|
(void) handle;
|
||||||
|
|
13
core/parse.c
13
core/parse.c
|
@ -12,6 +12,7 @@
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
|
|
||||||
int metric = 1;
|
int metric = 1;
|
||||||
|
int diveid = -1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
static union {
|
static union {
|
||||||
|
@ -516,3 +517,15 @@ void add_dive_site(char *ds_name, struct dive *dive)
|
||||||
free(to_free);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,7 @@ extern struct dive_table dive_table;
|
||||||
extern struct dive_table *target_table;
|
extern struct dive_table *target_table;
|
||||||
|
|
||||||
extern int metric;
|
extern int metric;
|
||||||
|
extern int diveid;
|
||||||
|
|
||||||
int trimspace(char *buffer);
|
int trimspace(char *buffer);
|
||||||
void clear_table(struct dive_table *table);
|
void clear_table(struct dive_table *table);
|
||||||
|
@ -96,5 +97,6 @@ void userid_stop(void);
|
||||||
void utf8_string(char *buffer, void *_res);
|
void utf8_string(char *buffer, void *_res);
|
||||||
|
|
||||||
void add_dive_site(char *ds_name, struct dive *dive);
|
void add_dive_site(char *ds_name, struct dive *dive);
|
||||||
|
int atoi_n(char *ptr, unsigned int len);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue