summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2012-12-05 17:15:28 (GMT)
committerDan Williams <dcbw@redhat.com>2012-12-05 17:43:58 (GMT)
commitdd51f7a6aeb5b133dad32918c73c3e7583a96d97 (patch)
treefb0be40ada3322f454ac9fb4b08b556faa62ad49
parent75731cf21c9eb64f70ba243122a7c384c4d1be00 (diff)
libmm-glib: document mm_get_uint_from_str()
Unlike strtol/stroul, this function doesn't ignore leading or trailing non-digit characters, so document that restriction.
-rw-r--r--libmm-glib/mm-common-helpers.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libmm-glib/mm-common-helpers.c b/libmm-glib/mm-common-helpers.c
index 9cfb842..3f100b6 100644
--- a/libmm-glib/mm-common-helpers.c
+++ b/libmm-glib/mm-common-helpers.c
@@ -700,6 +700,17 @@ mm_get_int_from_match_info (GMatchInfo *match_info,
return ret;
}
+/**
+ * mm_get_uint_from_str:
+ * @str: the string to convert to an unsigned int
+ * @out: on success, the number
+ *
+ * Converts a string to an unsigned number. All characters in the string
+ * MUST be valid digits (0 - 9), otherwise FALSE is returned.
+ *
+ * Returns: %TRUE if the string was converted, %FALSE if it was not or if it
+ * did not contain only digits.
+ */
gboolean
mm_get_uint_from_str (const gchar *str,
guint *out)