[PATCH v2] core: process SMS +CGMR response with regex
Aleksander Morgado
aleksander at aleksander.es
Wed Sep 16 00:21:48 PDT 2015
On Wed, Sep 16, 2015 at 12:26 AM, Dan Williams <dcbw at redhat.com> wrote:
>> + /* +CMGR: <stat>,<alpha>,<length>(whitespace)<pdu> */
>> + /* The <alpha> and <length> 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);
>
> You could also do g_assert_no_error (error) before the g_assert(r) too.
Passing the error here in g_regex_new() with a constant pattern isn't
very useful; if you didn't get an error in the regex when you tested
it, no one will get it. So either g_assert_no_error() as Dan suggests
or just pass NULL instead of error.
--
Aleksander
https://aleksander.es
More information about the ModemManager-devel
mailing list