projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Dates
[yaz-moved-to-github.git]
/
ccl
/
ccltoken.c
diff --git
a/ccl/ccltoken.c
b/ccl/ccltoken.c
index
12111b1
..
31a18d8
100644
(file)
--- a/
ccl/ccltoken.c
+++ b/
ccl/ccltoken.c
@@
-44,7
+44,7
@@
/* CCL - lexical analysis
* Europagate, 1995
*
/* CCL - lexical analysis
* Europagate, 1995
*
- * $Id: ccltoken.c,v 1.18 2001-11-27 22:38:50 adam Exp $
+ * $Id: ccltoken.c,v 1.22 2003-02-14 18:49:23 adam Exp $
*
* Old Europagate Log:
*
*
* Old Europagate Log:
*
@@
-85,6
+85,7
@@
#include <string.h>
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
+#include <ctype.h>
#include <yaz/ccl.h>
#include <yaz/ccl.h>
@@
-149,13
+150,13
@@
struct ccl_token *ccl_token_simple (const char *command)
}
if (!first)
{
}
if (!first)
{
- first = last = (struct ccl_token *)malloc (sizeof (*first));
+ first = last = (struct ccl_token *)xmalloc (sizeof (*first));
ccl_assert (first);
last->prev = NULL;
}
else
{
ccl_assert (first);
last->prev = NULL;
}
else
{
- last->next = (struct ccl_token *)malloc (sizeof(*first));
+ last->next = (struct ccl_token *)xmalloc (sizeof(*first));
ccl_assert (last->next);
last->next->prev = last;
last = last->next;
ccl_assert (last->next);
last->next->prev = last;
last = last->next;
@@
-213,13
+214,13
@@
struct ccl_token *ccl_parser_tokenize (CCL_parser cclp, const char *command)
}
if (!first)
{
}
if (!first)
{
- first = last = (struct ccl_token *)malloc (sizeof (*first));
+ first = last = (struct ccl_token *)xmalloc (sizeof (*first));
ccl_assert (first);
last->prev = NULL;
}
else
{
ccl_assert (first);
last->prev = NULL;
}
else
{
- last->next = (struct ccl_token *)malloc (sizeof(*first));
+ last->next = (struct ccl_token *)xmalloc (sizeof(*first));
ccl_assert (last->next);
last->next->prev = last;
last = last->next;
ccl_assert (last->next);
last->next->prev = last;
last = last->next;
@@
-244,7
+245,7
@@
struct ccl_token *ccl_parser_tokenize (CCL_parser cclp, const char *command)
case '%':
case '!':
last->kind = CCL_TOK_PROX;
case '%':
case '!':
last->kind = CCL_TOK_PROX;
- while (*cp == '%' || *cp == '!')
+ while (isdigit(*cp))
{
++ last->len;
cp++;
{
++ last->len;
cp++;
@@
-277,9
+278,9
@@
struct ccl_token *ccl_parser_tokenize (CCL_parser cclp, const char *command)
cp++;
break;
default:
cp++;
break;
default:
- if (!strchr ("(),%!><=- \t\n\r", cp[-1]))
+ if (!strchr ("(),%!><= \t\n\r", cp[-1]))
{
{
- while (*cp && !strchr ("(),%!><=- \t\n\r", *cp))
+ while (*cp && !strchr ("(),%!><= \t\n\r", *cp))
{
cp++;
++ last->len;
{
cp++;
++ last->len;
@@
-337,7
+338,7
@@
void ccl_token_del (struct ccl_token *list)
while (list)
{
list1 = list->next;
while (list)
{
list1 = list->next;
- free (list);
+ xfree (list);
list = list1;
}
}
list = list1;
}
}
@@
-345,14
+346,14
@@
void ccl_token_del (struct ccl_token *list)
char *ccl_strdup (const char *str)
{
int len = strlen(str);
char *ccl_strdup (const char *str)
{
int len = strlen(str);
- char *p = (char*) malloc (len+1);
+ char *p = (char*) xmalloc (len+1);
strcpy (p, str);
return p;
}
CCL_parser ccl_parser_create (void)
{
strcpy (p, str);
return p;
}
CCL_parser ccl_parser_create (void)
{
- CCL_parser p = (CCL_parser)malloc (sizeof(*p));
+ CCL_parser p = (CCL_parser)xmalloc (sizeof(*p));
if (!p)
return p;
p->look_token = NULL;
if (!p)
return p;
p->look_token = NULL;
@@
-373,11
+374,11
@@
void ccl_parser_destroy (CCL_parser p)
{
if (!p)
return;
{
if (!p)
return;
- free (p->ccl_token_and);
- free (p->ccl_token_or);
- free (p->ccl_token_not);
- free (p->ccl_token_set);
- free (p);
+ xfree (p->ccl_token_and);
+ xfree (p->ccl_token_or);
+ xfree (p->ccl_token_not);
+ xfree (p->ccl_token_set);
+ xfree (p);
}
void ccl_parser_set_op_and (CCL_parser p, const char *op)
}
void ccl_parser_set_op_and (CCL_parser p, const char *op)
@@
-385,7
+386,7
@@
void ccl_parser_set_op_and (CCL_parser p, const char *op)
if (p && op)
{
if (p->ccl_token_and)
if (p && op)
{
if (p->ccl_token_and)
- free (p->ccl_token_and);
+ xfree (p->ccl_token_and);
p->ccl_token_and = ccl_strdup (op);
}
}
p->ccl_token_and = ccl_strdup (op);
}
}
@@
-395,7
+396,7
@@
void ccl_parser_set_op_or (CCL_parser p, const char *op)
if (p && op)
{
if (p->ccl_token_or)
if (p && op)
{
if (p->ccl_token_or)
- free (p->ccl_token_or);
+ xfree (p->ccl_token_or);
p->ccl_token_or = ccl_strdup (op);
}
}
p->ccl_token_or = ccl_strdup (op);
}
}
@@
-404,7
+405,7
@@
void ccl_parser_set_op_not (CCL_parser p, const char *op)
if (p && op)
{
if (p->ccl_token_not)
if (p && op)
{
if (p->ccl_token_not)
- free (p->ccl_token_not);
+ xfree (p->ccl_token_not);
p->ccl_token_not = ccl_strdup (op);
}
}
p->ccl_token_not = ccl_strdup (op);
}
}
@@
-413,7
+414,7
@@
void ccl_parser_set_op_set (CCL_parser p, const char *op)
if (p && op)
{
if (p->ccl_token_set)
if (p && op)
{
if (p->ccl_token_set)
- free (p->ccl_token_set);
+ xfree (p->ccl_token_set);
p->ccl_token_set = ccl_strdup (op);
}
}
p->ccl_token_set = ccl_strdup (op);
}
}