diff options
author | Denis Kenzior <denkenz@gmail.com> | 2010-03-24 19:40:59 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2010-03-24 19:41:19 -0500 |
commit | 9ed01bfecdfd9c213d1de6d30755f14f948acb38 (patch) | |
tree | da6174e27b7325cc2b09b3c47e717ddd40ab15c7 | |
parent | a9c089ab345f06435c08ed87c86affb1c953ce71 (diff) | |
download | ofono-9ed01bfecdfd9c213d1de6d30755f14f948acb38.tar.bz2 |
Refactor: Simplify parsing logic
It isn't actually necessary to check the basic command prefixes, if the
extended prefix doesn't match we try to parse it like a basic command.
That one does the same exact check anyway. If that fails, then this is
not a recognized command line anyway.
-rw-r--r-- | gatchat/gatserver.c | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/gatchat/gatserver.c b/gatchat/gatserver.c index 711bf785..c75fbf53 100644 --- a/gatchat/gatserver.c +++ b/gatchat/gatserver.c @@ -194,17 +194,6 @@ static inline gboolean is_extended_command_prefix(const char c) } } -static gboolean is_basic_command_prefix(const char *buf) -{ - if (g_ascii_isalpha(buf[0])) - return TRUE; - - if (buf[0] == '&' && g_ascii_isalpha(buf[1])) - return TRUE; - - return FALSE; -} - static void at_command_notify(GAtServer *server, char *command, char *prefix, GAtServerRequestType type) { @@ -440,10 +429,8 @@ static void server_parse_line(GAtServer *server, char *line) if (is_extended_command_prefix(line[pos])) consumed = parse_extended_command(server, line + pos); - else if (is_basic_command_prefix(line + pos)) - consumed = parse_basic_command(server, line + pos); else - consumed = 0; + consumed = parse_basic_command(server, line + pos); if (consumed == 0) { g_at_server_send_final(server, |