aboutsummaryrefslogtreecommitdiffstats
path: root/lib/misc.c
diff options
context:
space:
mode:
authordequis <dx@dxzone.com.ar>2015-05-30 23:31:24 -0300
committerdequis <dx@dxzone.com.ar>2015-05-30 23:31:24 -0300
commit73f0a012a1f6b3e5fa3c7905e4f216b5ac29a30c (patch)
tree432ebfd4e2f953de24be099fc6e796b788242267 /lib/misc.c
parent6e21525c241d5f70767463577392aac481d3b051 (diff)
Move twitter_parse_id() to parse_int64() in misc.c
Diffstat (limited to 'lib/misc.c')
-rw-r--r--lib/misc.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/misc.c b/lib/misc.c
index c2a42c97..26a604cf 100644
--- a/lib/misc.c
+++ b/lib/misc.c
@@ -750,3 +750,19 @@ int truncate_utf8(char *string, int maxlen)
*end = '\0';
return end - string;
}
+
+/* Parses a guint64 from string, returns TRUE on success */
+gboolean parse_int64(char *string, int base, guint64 *number)
+{
+ guint64 parsed;
+ char *endptr;
+
+ errno = 0;
+ parsed = g_ascii_strtoull(string, &endptr, base);
+ if (errno || endptr == string || *endptr != '\0') {
+ return FALSE;
+ }
+ *number = parsed;
+ return TRUE;
+}
+