summaryrefslogtreecommitdiffstats
path: root/gatchat/gatresult.c
diff options
context:
space:
mode:
authorFrédéric Danis <frederic.danis@linux.intel.com>2011-02-24 18:16:05 +0100
committerDenis Kenzior <denkenz@gmail.com>2011-02-24 14:01:23 -0600
commit8f8559edf68e4d10670e82d5368844db68e25d31 (patch)
tree8ab63a7b3d3c587c263dbde0349b380d060bc5a5 /gatchat/gatresult.c
parent82b75c0bb69e8fb929066e2ca2cd0c0b9a785798 (diff)
downloadofono-8f8559edf68e4d10670e82d5368844db68e25d31.tar.bz2
gatchat: add g_at_result_iter_next_number_default API
Diffstat (limited to 'gatchat/gatresult.c')
-rw-r--r--gatchat/gatresult.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/gatchat/gatresult.c b/gatchat/gatresult.c
index 8a6dfae4..f9924869 100644
--- a/gatchat/gatresult.c
+++ b/gatchat/gatresult.c
@@ -292,6 +292,36 @@ gboolean g_at_result_iter_next_number(GAtResultIter *iter, gint *number)
return TRUE;
}
+gboolean g_at_result_iter_next_number_default(GAtResultIter *iter, gint dflt,
+ gint *number)
+{
+ unsigned int pos;
+ int len;
+ char *line;
+
+ if (iter == NULL)
+ return FALSE;
+
+ if (iter->l == NULL)
+ return FALSE;
+
+ line = iter->l->data;
+ len = strlen(line);
+
+ pos = skip_to_next_field(line, iter->line_pos, len);
+
+ if (pos != iter->line_pos) {
+ iter->line_pos = pos;
+
+ if (number)
+ *number = dflt;
+
+ return TRUE;
+ }
+
+ return g_at_result_iter_next_number(iter, number);
+}
+
gboolean g_at_result_iter_next_range(GAtResultIter *iter, gint *min, gint *max)
{
int pos;