X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=recctrl%2Fregxread.c;h=2b674245d3d4c0b8f78f285b65ddbf7aa27f4080;hb=52365e1ba3d9ffe33ed10788a8a91cb4fa7d6133;hp=2e51f6719c25dc5b2640f7e1957e47ad391d053a;hpb=b306d131fe1c06ca1d313f3b04a159b4a3a376f9;p=idzebra-moved-to-github.git diff --git a/recctrl/regxread.c b/recctrl/regxread.c index 2e51f67..2b67424 100644 --- a/recctrl/regxread.c +++ b/recctrl/regxread.c @@ -4,7 +4,16 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: regxread.c,v $ - * Revision 1.14 1998-03-05 08:41:00 adam + * Revision 1.17 1998-07-01 10:13:51 adam + * Minor fix. + * + * Revision 1.16 1998/06/30 15:15:09 adam + * Tags are trimmed: white space removed before- and after the tag. + * + * Revision 1.15 1998/06/30 12:55:45 adam + * Bug fix. + * + * Revision 1.14 1998/03/05 08:41:00 adam * Implemented rule contexts. * * Revision 1.13 1997/12/12 06:33:58 adam @@ -132,6 +141,7 @@ #include #include #include +#include #include #include @@ -703,8 +713,6 @@ static void execData (struct lexSpec *spec, char *nb = xmalloc (elen + res->u.data.len); memcpy (nb, res->u.data.data, res->u.data.len); memcpy (nb + res->u.data.len, ebuf, elen); - if (res->u.data.len > DATA1_LOCALDATA) - xfree (res->u.data.data); res->u.data.data = nb; res->destroy = destroy_data; } @@ -827,6 +835,19 @@ static void variantBegin (struct lexSpec *spec, d1_stack[++(*d1_level)] = NULL; } +static void tagStrip (const char **tag, int *len) +{ + int i; + + for (i = *len; i > 0 && isspace((*tag)[i-1]); --i) + ; + *len = i; + for (i = 0; i < *len && isspace((*tag)[i]); i++) + ; + *tag += i; + *len -= i; +} + static void tagBegin (struct lexSpec *spec, data1_node **d1_stack, int *d1_level, const char *tag, int len) @@ -843,7 +864,8 @@ static void tagBegin (struct lexSpec *spec, logf (LOG_WARN, "in element begin. No record type defined"); return ; } - + tagStrip (&tag, &len); + res = data1_mk_node (spec->dh, spec->m); res->parent = parent; res->which = DATA1N_tag; @@ -885,6 +907,7 @@ static void tagEnd (struct lexSpec *spec, data1_node **d1_stack, int *d1_level, const char *tag, int len) { + tagStrip (&tag, &len); while (*d1_level > 1) { (*d1_level)--; @@ -1605,6 +1628,7 @@ data1_node *grs_read_regx (struct grs_read_info *p) return NULL; } } + curLexSpec->dh = p->dh; if (!p->offset) { curLexSpec->f_win_start = 0;