From 1e119f37b85b90c5a9a17fdcbc80625727b4ab66 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 15 Dec 2009 19:54:51 +0100 Subject: fix all instances of atoi() usage Signed-off-by: Denys Vlasenko --- inc/abrtlib.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'inc') 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 -- cgit