diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-05-07 22:06:07 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-05-07 22:06:07 +0200 |
commit | 48365ece438ee7d79dcb04d4a28d02fbfe7a1b02 (patch) | |
tree | 2803ef24f1f636170888d5a5fb7cfad86b535f8a /src/libmdsserver/util.h | |
parent | m (diff) | |
download | mds-48365ece438ee7d79dcb04d4a28d02fbfe7a1b02.tar.gz mds-48365ece438ee7d79dcb04d4a28d02fbfe7a1b02.tar.bz2 mds-48365ece438ee7d79dcb04d4a28d02fbfe7a1b02.tar.xz |
use more macros and do not du null-check before free:ing, free does that for us
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/libmdsserver/util.h')
-rw-r--r-- | src/libmdsserver/util.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libmdsserver/util.h b/src/libmdsserver/util.h index 3a6e9b1..3de6f02 100644 --- a/src/libmdsserver/util.h +++ b/src/libmdsserver/util.h @@ -63,6 +63,17 @@ int xsigaction(int signo, void (*function)(int signo)); */ size_t send_message(int socket, const char* message, size_t length); +/** + * A version of `atoi` that is strict about the syntax and bounds + * + * @param str The text to parse + * @param value Slot in which to store the value + * @param min The minimum accepted value + * @param max The maximum accepted value + * @return Zero on success, -1 on syntax error + */ +int strict_atoi(const char* str, int* value, int min, int max); + #endif |