Re: [PATCH v2] core: process SMS +CGMR response with regex

2015-09-16 Thread Aleksander Morgado
On Wed, Sep 16, 2015 at 3:21 PM, Nick Stevens wrote: >> > + >> > +if (g_regex_match_full (r, reply, strlen (reply), 0, 0, &match_info, >> > &match_error)) { >> >> I think you should also just restructure the function with a 'goto' for >> error handling to break out early. Yeah it's a goto, b

Re: [PATCH v2] core: process SMS +CGMR response with regex

2015-09-16 Thread Nick Stevens
On Tue, Sep 15, 2015 at 05:26:06PM -0500, Dan Williams wrote: > On Tue, 2015-09-15 at 20:15 +, Nick Stevens wrote: > > Variability in the response style from certain modems causes the parsing > > of the +CGMR response to fail. For example, the Telit HE910 inserts an > > empty string ("") in the

Re: [PATCH v2] core: process SMS +CGMR response with regex

2015-09-16 Thread Nick Stevens
On Wed, Sep 16, 2015 at 09:21:48AM +0200, Aleksander Morgado wrote: > On Wed, Sep 16, 2015 at 12:26 AM, Dan Williams wrote: > >> +/* +CMGR: ,,(whitespace) */ > >> +/* The and fields are matched, but not currently > >> used */ > >> +r = g_regex_new > >> ("\\+CMGR:\\s*(\\d+)\\s*,([^,

Re: [PATCH v2] core: process SMS +CGMR response with regex

2015-09-16 Thread Aleksander Morgado
On Wed, Sep 16, 2015 at 12:26 AM, Dan Williams wrote: >> +/* +CMGR: ,,(whitespace) */ >> +/* The and fields are matched, but not currently used >> */ >> +r = g_regex_new >> ("\\+CMGR:\\s*(\\d+)\\s*,([^,]*),\\s*(\\d+)\\s*([^\\r\\n]*)", 0, 0, error); >> +g_assert (r != NULL); > >

Re: [PATCH v2] core: process SMS +CGMR response with regex

2015-09-15 Thread Dan Williams
On Tue, 2015-09-15 at 20:15 +, Nick Stevens wrote: > Variability in the response style from certain modems causes the parsing > of the +CGMR response to fail. For example, the Telit HE910 inserts an > empty string ("") in the second field of the response, causing the > sscanf implementation to

[PATCH v2] core: process SMS +CGMR response with regex

2015-09-15 Thread Nick Stevens
Variability in the response style from certain modems causes the parsing of the +CGMR response to fail. For example, the Telit HE910 inserts an empty string ("") in the second field of the response, causing the sscanf implementation to fail. This patch converts the parsing of the CGMR response to