summaryrefslogtreecommitdiffstats
path: root/inc
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-12-15 19:54:51 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2009-12-15 19:54:51 +0100
commit1e119f37b85b90c5a9a17fdcbc80625727b4ab66 (patch)
tree2eda8402810f7148304c3f7ee878b86c9dcb67c8 /inc
parent661875fe000fd0d8469ae20d587fa84624d7f262 (diff)
downloadabrt-1e119f37b85b90c5a9a17fdcbc80625727b4ab66.tar.gz
abrt-1e119f37b85b90c5a9a17fdcbc80625727b4ab66.tar.xz
abrt-1e119f37b85b90c5a9a17fdcbc80625727b4ab66.zip
fix all instances of atoi() usage
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'inc')
-rw-r--r--inc/abrtlib.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/inc/abrtlib.h b/inc/abrtlib.h
index 17bd5429..c5ca60f7 100644
--- a/inc/abrtlib.h
+++ b/inc/abrtlib.h
@@ -102,6 +102,15 @@ char* xstrndup(const char *s, int n);
char* skip_whitespace(const char *s);
char* skip_non_whitespace(const char *s);
+unsigned xatou(const char *numstr);
+int xatoi(const char *numstr);
+/* Using xatoi() instead of naive atoi() is not always convenient -
+ * in many places people want *non-negative* values, but store them
+ * in signed int. Therefore we need this one:
+ * dies if input is not in [0, INT_MAX] range. Also will reject '-0' etc */
+int xatoi_u(const char *numstr);
+
+
extern ssize_t safe_read(int fd, void *buf, size_t count);
// NB: will return short read on error, not -1,
// if some data was read before error occurred