Browse Source

Merge pull request #4 from vincentbernat/fix/various-warnings

Fix various warnings
pull/8/head v3.0.1
Tom G. Huang 10 years ago
parent
commit
de93cfd85f
  1. 29
      argtable3.c

29
argtable3.c

@ -2841,7 +2841,7 @@ struct arg_rex * arg_rexn(const char * shortopts,
size_t nbytes;
struct arg_rex *result;
struct privhdr *priv;
int errorcode, i;
int i;
const TRexChar *error = NULL;
TRex *rex = NULL;
@ -2901,7 +2901,6 @@ struct arg_rex * arg_rexn(const char * shortopts,
rex = trex_compile(priv->pattern, &error, priv->flags);
if (rex == NULL)
{
errorcode = EREGNOMATCH;
ARG_LOG(("argtable: %s \"%s\"\n", error ? error : _TREXC("undefined"), priv->pattern));
ARG_LOG(("argtable: Bad argument table.\n"));
}
@ -3005,7 +3004,6 @@ static int trex_newnode(TRex *exp, TRexNodeType type)
if(type == OP_EXPR)
n.right = exp->_nsubexpr++;
if(exp->_nallocated < (exp->_nsize + 1)) {
int oldsize = exp->_nallocated;
exp->_nallocated *= 2;
exp->_nodes = (TRexNode *)realloc(exp->_nodes, exp->_nallocated * sizeof(TRexNode));
}
@ -3185,7 +3183,6 @@ static int trex_element(TRex *exp)
}
{
int op;
TRexBool isgreedy = TRex_False;
unsigned short p0 = 0, p1 = 0;
switch(*exp->_p){
@ -3219,7 +3216,6 @@ static int trex_element(TRex *exp)
}
if(isgreedy) {
int nnode = trex_newnode(exp,OP_GREEDY);
op = OP_GREEDY;
exp->_nodes[nnode].left = ret;
exp->_nodes[nnode].right = ((p0)<<16)|p1;
ret = nnode;
@ -3421,10 +3417,10 @@ static const TRexChar *trex_matchnode(TRex* exp,TRexNode *node,const TRexChar *s
return cur;
}
case OP_WB:
if(str == exp->_bol && !isspace(*str)
|| (str == exp->_eol && !isspace(*(str-1)))
|| (!isspace(*str) && isspace(*(str+1)))
|| (isspace(*str) && !isspace(*(str+1))) ) {
if((str == exp->_bol && !isspace(*str))
|| ((str == exp->_eol && !isspace(*(str-1))))
|| ((!isspace(*str) && isspace(*(str+1))))
|| ((isspace(*str) && !isspace(*(str+1)))) ) {
return (node->left == 'b')?str:NULL;
}
return (node->left == 'b')?NULL:str;
@ -3434,20 +3430,19 @@ static const TRexChar *trex_matchnode(TRex* exp,TRexNode *node,const TRexChar *s
case OP_EOL:
if(str == exp->_eol) return str;
return NULL;
case OP_DOT:{
*str++;
}
case OP_DOT:
str++;
return str;
case OP_NCLASS:
case OP_CLASS:
if(trex_matchclass(exp,&exp->_nodes[node->left],*str)?(type == OP_CLASS?TRex_True:TRex_False):(type == OP_NCLASS?TRex_True:TRex_False)) {
*str++;
str++;
return str;
}
return NULL;
case OP_CCLASS:
if(trex_matchcclass(node->left,*str)) {
*str++;
str++;
return str;
}
return NULL;
@ -3460,7 +3455,7 @@ static const TRexChar *trex_matchnode(TRex* exp,TRexNode *node,const TRexChar *s
{
if (*str != node->type) return NULL;
}
*str++;
str++;
return str;
}
return NULL;
@ -3551,7 +3546,7 @@ TRexBool trex_searchrange(TRex* exp,const TRexChar* text_begin,const TRexChar* t
break;
node = exp->_nodes[node].next;
}
*text_begin++;
text_begin++;
} while(cur == NULL && text_begin != text_end);
if(cur == NULL)
@ -3842,7 +3837,7 @@ struct longoptions
struct option *options;
};
#ifndef NDEBUG
#if 0
static
void dump_longoptions(struct longoptions * longoptions)
{

Loading…
Cancel
Save