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
Using NMEM rather than ODR for memory stuff.
[idzebra-moved-to-github.git]
/
index
/
regxread.c
diff --git
a/index/regxread.c
b/index/regxread.c
index
993fb53
..
ecf8f95
100644
(file)
--- a/
index/regxread.c
+++ b/
index/regxread.c
@@
-1,8
+1,5
@@
-/* $Id: regxread.c,v 1.3 2006-08-22 13:39:27 adam Exp $
- Copyright (C) 1995-2006
- Index Data ApS
-
-This file is part of the Zebra server.
+/* This file is part of the Zebra server.
+ Copyright (C) 1995-2008 Index Data
Zebra is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Zebra is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
@@
-646,7
+643,7
@@
int readFileSpec (struct lexSpec *spec)
}
}
fclose (spec_inf);
}
}
fclose (spec_inf);
- wrbuf_free(lineBuf, 1);
+ wrbuf_destroy(lineBuf);
for (lc = spec->context; lc; lc = lc->next)
{
for (lc = spec->context; lc; lc = lc->next)
{
@@
-1692,7
+1689,7
@@
static int execRule (struct lexSpec *spec, struct lexContext *context,
start_ptr, pptr);
}
start_ptr, pptr);
}
-data1_node *lexNode (struct lexSpec *spec, int *ptr)
+int lexNode (struct lexSpec *spec, int *ptr)
{
struct lexContext *context = spec->context_stack[spec->context_stack_top];
struct DFA_state *state = context->dfa->states[0];
{
struct lexContext *context = spec->context_stack[spec->context_stack_top];
struct DFA_state *state = context->dfa->states[0];
@@
-1704,6
+1701,7
@@
data1_node *lexNode (struct lexSpec *spec, int *ptr)
int last_ptr = *ptr; /* last char of match */
int start_ptr = *ptr; /* first char of match */
int skip_ptr = *ptr; /* first char of run */
int last_ptr = *ptr; /* last char of match */
int start_ptr = *ptr; /* first char of match */
int skip_ptr = *ptr; /* first char of run */
+ int more = 0;
while (1)
{
while (1)
{
@@
-1726,7
+1724,7
@@
data1_node *lexNode (struct lexSpec *spec, int *ptr)
*ptr = last_ptr;
/* execute rule */
if (!execRule (spec, context, last_rule, start_ptr, ptr))
*ptr = last_ptr;
/* execute rule */
if (!execRule (spec, context, last_rule, start_ptr, ptr))
- break;
+ return more;
/* restore skip pointer */
skip_ptr = *ptr;
last_rule = 0;
/* restore skip pointer */
skip_ptr = *ptr;
last_rule = 0;
@@
-1739,8
+1737,9
@@
data1_node *lexNode (struct lexSpec *spec, int *ptr)
buf = f_win_get (spec, skip_ptr, *ptr, &size);
execDataP (spec, buf, size, 0);
}
buf = f_win_get (spec, skip_ptr, *ptr, &size);
execDataP (spec, buf, size, 0);
}
+ state = context->dfa->states[0];
if (*ptr == F_WIN_EOF)
if (*ptr == F_WIN_EOF)
- break;
+ return more;
}
t = state->trans;
i = state->tran_no;
}
t = state->trans;
i = state->tran_no;
@@
-1769,7
+1768,7
@@
data1_node *lexNode (struct lexSpec *spec, int *ptr)
#endif
(*spec->f_win_ef)(spec->stream, &end_offset);
}
#endif
(*spec->f_win_ef)(spec->stream, &end_offset);
}
- return NULL;
+ return more;
}
context = spec->context_stack[spec->context_stack_top];
skip_ptr = *ptr;
}
context = spec->context_stack[spec->context_stack_top];
skip_ptr = *ptr;
@@
-1804,13
+1803,14
@@
data1_node *lexNode (struct lexSpec *spec, int *ptr)
last_rule = state->rule_nno;
last_ptr = *ptr;
}
last_rule = state->rule_nno;
last_ptr = *ptr;
}
+ more = 1;
}
break;
}
else
t++;
}
}
break;
}
else
t++;
}
- return NULL;
+ return more;
}
static data1_node *lexRoot (struct lexSpec *spec, off_t offset,
}
static data1_node *lexRoot (struct lexSpec *spec, off_t offset,
@@
-1818,6
+1818,7
@@
static data1_node *lexRoot (struct lexSpec *spec, off_t offset,
{
struct lexContext *lt = spec->context;
int ptr = offset;
{
struct lexContext *lt = spec->context;
int ptr = offset;
+ int ret;
spec->stop_flag = 0;
spec->d1_level = 0;
spec->stop_flag = 0;
spec->d1_level = 0;
@@
-1843,12
+1844,15
@@
static data1_node *lexRoot (struct lexSpec *spec, off_t offset,
}
#endif
execAction (spec, lt->beginActionList, ptr, &ptr);
}
#endif
execAction (spec, lt->beginActionList, ptr, &ptr);
- lexNode (spec, &ptr);
+
+ ret = lexNode (spec, &ptr);
while (spec->d1_level)
{
tagDataRelease (spec);
(spec->d1_level)--;
}
while (spec->d1_level)
{
tagDataRelease (spec);
(spec->d1_level)--;
}
+ if (!ret)
+ return 0;
execAction (spec, lt->endActionList, ptr, &ptr);
return spec->d1_stack[0];
}
execAction (spec, lt->endActionList, ptr, &ptr);
return spec->d1_stack[0];
}