diff options
Diffstat (limited to 'saedit/common.c')
-rw-r--r-- | saedit/common.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/saedit/common.c b/saedit/common.c new file mode 100644 index 0000000..9bb8a30 --- /dev/null +++ b/saedit/common.c @@ -0,0 +1,22 @@ +#include "common.h" + +#include <stdlib.h> +#include <errno.h> + +gboolean +try_strtoint ( + const gchar *str, + gint *result +) { + gchar *endptr; + gint retval; + + errno = 0; + retval = strtol (str, &endptr, 10); + + if (*endptr != 0 || errno != 0) + return FALSE; + + *result = retval; + return TRUE; +} |