From 73f0a012a1f6b3e5fa3c7905e4f216b5ac29a30c Mon Sep 17 00:00:00 2001 From: dequis Date: Sat, 30 May 2015 23:31:24 -0300 Subject: Move twitter_parse_id() to parse_int64() in misc.c --- protocols/twitter/twitter.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) (limited to 'protocols/twitter/twitter.c') diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c index 4debc08a..7f5e0368 100644 --- a/protocols/twitter/twitter.c +++ b/protocols/twitter/twitter.c @@ -858,23 +858,6 @@ static void twitter_buddy_data_free(struct bee_user *bu) g_free(bu->data); } -/* Parses a decimal or hex tweet ID, returns TRUE on success */ -static gboolean twitter_parse_id(char *string, int base, guint64 *id) -{ - guint64 parsed; - char *endptr; - - errno = 0; - parsed = g_ascii_strtoull(string, &endptr, base); - if (errno || endptr == string || *endptr != '\0') { - return FALSE; - } - *id = parsed; - return TRUE; -} - -bee_user_t twitter_log_local_user; - /** Convert the given bitlbee tweet ID, bitlbee username, or twitter tweet ID * into a twitter tweet ID. * @@ -902,10 +885,10 @@ static guint64 twitter_message_id_from_command_arg(struct im_connection *ic, cha if (arg[0] == '#') { arg++; } - if (twitter_parse_id(arg, 16, &id) && id < TWITTER_LOG_LENGTH) { + if (parse_int64(arg, 16, &id) && id < TWITTER_LOG_LENGTH) { bu = td->log[id].bu; id = td->log[id].id; - } else if (twitter_parse_id(arg, 10, &id)) { + } else if (parse_int64(arg, 10, &id)) { /* Allow normal tweet IDs as well; not a very useful feature but it's always been there. Just ignore very low IDs to avoid accidents. */ -- cgit v1.2.3