projects
/
idzebra-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
optimize for C source code
[idzebra-moved-to-github.git]
/
recctrl
/
recgrs.c
diff --git
a/recctrl/recgrs.c
b/recctrl/recgrs.c
index
2ea2a53
..
da1ad60
100644
(file)
--- a/
recctrl/recgrs.c
+++ b/
recctrl/recgrs.c
@@
-1,4
+1,4
@@
-/* $Id: recgrs.c,v 1.104 2005-08-03 07:44:27 adam Exp $
+/* $Id: recgrs.c,v 1.108 2006-02-07 00:17:44 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-220,16
+220,20
@@
static int sp_expr(struct source_parser *sp, data1_node *n, RecWord *wrd)
}
else if (sp->len > 0 && isdigit(*(unsigned char *)sp->tok))
{
}
else if (sp->len > 0 && isdigit(*(unsigned char *)sp->tok))
{
- wrd->term_buf = nmem_malloc(sp->nmem, sp->len);
- memcpy(wrd->term_buf, sp->tok, sp->len);
+ char *b;
wrd->term_len = sp->len;
wrd->term_len = sp->len;
+ b = nmem_malloc(sp->nmem, sp->len);
+ memcpy(b, sp->tok, sp->len);
+ wrd->term_buf = b;
sp_lex(sp);
}
else if (sp->len > 2 && sp->tok[0] == '\'' && sp->tok[sp->len-1] == '\'')
{
sp_lex(sp);
}
else if (sp->len > 2 && sp->tok[0] == '\'' && sp->tok[sp->len-1] == '\'')
{
+ char *b;
wrd->term_len = sp->len - 2;
wrd->term_len = sp->len - 2;
- wrd->term_buf = nmem_malloc(sp->nmem, wrd->term_len);
- memcpy(wrd->term_buf, sp->tok+1, wrd->term_len);
+ b = nmem_malloc(sp->nmem, wrd->term_len);
+ memcpy(b, sp->tok+1, wrd->term_len);
+ wrd->term_buf = b;
sp_lex(sp);
}
else
sp_lex(sp);
}
else
@@
-346,6
+350,7
@@
static int dfa_match_first(struct DFA_state **dfaar, const char *text)
unsigned char c;
for (c = *p++, t = s->trans, i = s->tran_no; --i >= 0; t++)
unsigned char c;
for (c = *p++, t = s->trans, i = s->tran_no; --i >= 0; t++)
+ {
if (c >= t->ch[0] && c <= t->ch[1])
{
while (i >= 0)
if (c >= t->ch[0] && c <= t->ch[1])
{
while (i >= 0)
@@
-355,12
+360,15
@@
static int dfa_match_first(struct DFA_state **dfaar, const char *text)
if (s->rule_no)
return 1;
/* next char */
if (s->rule_no)
return 1;
/* next char */
+ if (!c)
+ return 0;
c = *p++;
for (t = s->trans, i = s->tran_no; --i >= 0; t++)
if (c >= t->ch[0] && c <= t->ch[1])
break;
}
}
c = *p++;
for (t = s->trans, i = s->tran_no; --i >= 0; t++)
if (c >= t->ch[0] && c <= t->ch[1])
break;
}
}
+ }
return 0;
}
return 0;
}
@@
-809,7
+817,7
@@
static void index_xpath(struct source_parser *sp, data1_node *n,
p, wrd);
xpdone = 1;
} else {
p, wrd);
xpdone = 1;
} else {
- /* add attribute based index for the attribute */
+ /* index attribute value (only path/@attr) */
if (xp->value)
{
#if NATTR
if (xp->value)
{
#if NATTR