summaryrefslogtreecommitdiff
path: root/fitz
diff options
context:
space:
mode:
Diffstat (limited to 'fitz')
-rw-r--r--fitz/base_string.c7
-rw-r--r--fitz/fitz-internal.h3
2 files changed, 10 insertions, 0 deletions
diff --git a/fitz/base_string.c b/fitz/base_string.c
index fbb1cf4d..7385b500 100644
--- a/fitz/base_string.c
+++ b/fitz/base_string.c
@@ -255,3 +255,10 @@ float fz_atof(const char *s)
d = fz_clampd(d, -FLT_MAX, FLT_MAX);
return (float)d;
}
+
+int fz_atoi(const char *s)
+{
+ if (s == NULL)
+ return 0;
+ return atoi(s);
+}
diff --git a/fitz/fitz-internal.h b/fitz/fitz-internal.h
index 58b77c94..e853188d 100644
--- a/fitz/fitz-internal.h
+++ b/fitz/fitz-internal.h
@@ -247,6 +247,9 @@ static inline float my_atan2f(float o, float a)
/* Range checking atof */
float fz_atof(const char *s);
+/* atoi that copes with NULL */
+int fz_atoi(const char *s);
+
/*
* Generic hash-table with fixed-length keys.
*/