ifx: Don't use g_utf8_validate

Emergency Numbers can only be digits, so there's no point to use the
'Hammer of Thor' that is g_utf8_validate when a much simpler function
will do the job just as well.
This commit is contained in:
Denis Kenzior 2012-02-10 00:38:37 -06:00
parent 2708ca3b63
commit 9d666ccce0
1 changed files with 7 additions and 7 deletions

View File

@ -794,7 +794,8 @@ static void xlema_notify(GAtResult *result, gpointer user_data)
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
GAtResultIter iter;
int index, total_cnt;
const char *number, *end;
const char *number;
int len;
int count = (vd->en_list == NULL) ? 0 : g_strv_length(vd->en_list);
g_at_result_iter_init(&iter, result);
@ -826,12 +827,11 @@ static void xlema_notify(GAtResult *result, gpointer user_data)
if (vd->en_list == NULL)
vd->en_list = g_new0(char *, total_cnt + 1);
if (g_utf8_validate(number, -1, &end) == FALSE) {
vd->en_list[count] = g_strndup(number, end - number);
ofono_warn("Malformed emergency number: %s",
vd->en_list[count]);
} else
vd->en_list[count] = g_strdup(number);
len = strspn(number, "0123456789");
vd->en_list[count] = g_strndup(number, len);
if (number[len] != '\0')
ofono_warn("Malformed emergency number: %.*s", len, number);
done:
if (index != total_cnt)