version 1.2, 2015/11/19 22:16:43 |
version 1.3, 2015/11/19 23:20:34 |
|
|
const int errbuf_sz = 200; |
const int errbuf_sz = 200; |
char *errbuf, *rxerr; |
char *errbuf, *rxerr; |
|
|
errbuf = (char*)flex_alloc(errbuf_sz *sizeof(char)); |
errbuf = (char*)malloc(errbuf_sz *sizeof(char)); |
if (!errbuf) |
if (!errbuf) |
flexfatal(_("Unable to allocate buffer to report regcomp")); |
flexfatal(_("Unable to allocate buffer to report regcomp")); |
rxerr = (char*)flex_alloc(errbuf_sz *sizeof(char)); |
rxerr = (char*)malloc(errbuf_sz *sizeof(char)); |
if (!rxerr) |
if (!rxerr) |
flexfatal(_("Unable to allocate buffer for regerror")); |
flexfatal(_("Unable to allocate buffer for regerror")); |
regerror (err, preg, rxerr, errbuf_sz); |
regerror (err, preg, rxerr, errbuf_sz); |
|
|
if (m == NULL || m->rm_so < 0) |
if (m == NULL || m->rm_so < 0) |
return NULL; |
return NULL; |
len = m->rm_eo - m->rm_so; |
len = m->rm_eo - m->rm_so; |
str = (char *) flex_alloc ((len + 1) * sizeof (char)); |
str = (char *) malloc ((len + 1) * sizeof (char)); |
if (!str) |
if (!str) |
flexfatal(_("Unable to allocate a copy of the match")); |
flexfatal(_("Unable to allocate a copy of the match")); |
strncpy (str, src + m->rm_so, len); |
strncpy (str, src + m->rm_so, len); |