g_match_info_fetch_named not return empty string as expected
Submitted by cee1
Link to original bug (#588217)
Description
I'm matching "uint32_t *i_n" against pattern(compile_flags: G_REGEX_NO_AUTO_CAPTURE | G_REGEX_OPTIMIZE | G_REGEX_DUPNAMES,match_flags: 0)
:
^\s*+(?:(?P`<type>`[_a-zA-Z][_a-zA-Z0-9]*+)|(?:const\s+)(?P`<type>`[_a-zA-Z][_a-zA-Z0-9]*+)|(?P`<type>`[_a-zA-Z][_a-zA-Z0-9]*+)(?:\s+const))(?:\s*+(?P`<star>`\*)\s*+|\s*+)((?P`<nm>`[nm])|(?P`<stride>`(?P`<arg_class>`[isd])s(?P`<index>`\d?))|(?P`<array>`(?P`<arg_class>`[isd])(?P`<index>`\d?)(_(?P`<len1>`\d+|[nm](p\d+)?)(x(?P`<len2>`\d+|[nm](p\d+)?))?)?))\s*+$
Then call g_match_info_fetch_named (param_info, "len2")
, it returns NULL
instead of an empty string, which is incorrect according to the document (http://library.gnome.org/devel/glib/stable/glib-Perl-compatible-regular-expressions.html#g-match-info-fetch-named)
Version: 2.20.x
Edited by Emmanuele Bassi