1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-08-08 17:42:14 +03:00

Remove useless comparisons

Found by lgtm.com
This commit is contained in:
Nick Wellnhofer
2020-01-02 14:14:48 +01:00
parent c9faa29259
commit 9bd7abfba4
5 changed files with 114 additions and 122 deletions

View File

@@ -1251,7 +1251,6 @@ xmlNanoFTPConnectTo(const char *server, int port) {
xmlNanoFTPFreeCtxt(ctxt); xmlNanoFTPFreeCtxt(ctxt);
return(NULL); return(NULL);
} }
if (port != 0)
ctxt->port = port; ctxt->port = port;
res = xmlNanoFTPConnect(ctxt); res = xmlNanoFTPConnect(ctxt);
if (res < 0) { if (res < 0) {

View File

@@ -3912,7 +3912,6 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
"AttValue length too long\n"); "AttValue length too long\n");
goto mem_error; goto mem_error;
} }
if (c == 0) break;
if (c == '&') { if (c == '&') {
in_space = 0; in_space = 0;
if (NXT(1) == '#') { if (NXT(1) == '#') {

View File

@@ -5919,8 +5919,7 @@ xmlValidatePushCData(xmlValidCtxtPtr ctxt, const xmlChar *data, int len) {
break; break;
case XML_ELEMENT_TYPE_MIXED: case XML_ELEMENT_TYPE_MIXED:
break; break;
case XML_ELEMENT_TYPE_ELEMENT: case XML_ELEMENT_TYPE_ELEMENT: {
if (len > 0) {
int i; int i;
for (i = 0;i < len;i++) { for (i = 0;i < len;i++) {
@@ -5939,11 +5938,11 @@ xmlValidatePushCData(xmlValidCtxtPtr ctxt, const xmlChar *data, int len) {
* element types with element content, if white space * element types with element content, if white space
* occurs directly within any instance of those types. * occurs directly within any instance of those types.
*/ */
}
break; break;
} }
} }
} }
}
done: done:
return(ret); return(ret);
} }

View File

@@ -6055,7 +6055,7 @@ xmlAutomataNewOnceTrans2(xmlAutomataPtr am, xmlAutomataStatePtr from,
return(NULL); return(NULL);
if (min < 1) if (min < 1)
return(NULL); return(NULL);
if ((max < min) || (max < 1)) if (max < min)
return(NULL); return(NULL);
atom = xmlRegNewAtom(am, XML_REGEXP_STRING); atom = xmlRegNewAtom(am, XML_REGEXP_STRING);
if (atom == NULL) if (atom == NULL)
@@ -6134,7 +6134,7 @@ xmlAutomataNewOnceTrans(xmlAutomataPtr am, xmlAutomataStatePtr from,
return(NULL); return(NULL);
if (min < 1) if (min < 1)
return(NULL); return(NULL);
if ((max < min) || (max < 1)) if (max < min)
return(NULL); return(NULL);
atom = xmlRegNewAtom(am, XML_REGEXP_STRING); atom = xmlRegNewAtom(am, XML_REGEXP_STRING);
if (atom == NULL) if (atom == NULL)

View File

@@ -24184,7 +24184,7 @@ xmlSchemaValidateFacets(xmlSchemaAbstractCtxtPtr actxt,
unsigned long length, unsigned long length,
int fireErrors) int fireErrors)
{ {
int ret, error = 0; int ret, error = 0, found;
xmlSchemaTypePtr tmpType; xmlSchemaTypePtr tmpType;
xmlSchemaFacetLinkPtr facetLink; xmlSchemaFacetLinkPtr facetLink;
@@ -24308,8 +24308,7 @@ WXS_IS_LIST:
} }
pattern_and_enum: pattern_and_enum:
if (error >= 0) { found = 0;
int found = 0;
/* /*
* Process enumerations. Facet values are in the value space * Process enumerations. Facet values are in the value space
* of the defining type's base type. This seems to be a bug in the * of the defining type's base type. This seems to be a bug in the
@@ -24356,10 +24355,7 @@ pattern_and_enum:
if (error == 0) if (error == 0)
error = ret; error = ret;
} }
}
if (error >= 0) {
int found;
/* /*
* Process patters. Pattern facets are ORed at type level * Process patters. Pattern facets are ORed at type level
* and ANDed if derived. Walk the base type axis. * and ANDed if derived. Walk the base type axis.
@@ -24404,7 +24400,6 @@ pattern_and_enum:
} }
tmpType = tmpType->baseType; tmpType = tmpType->baseType;
} while ((tmpType != NULL) && (tmpType->type != XML_SCHEMA_TYPE_BASIC)); } while ((tmpType != NULL) && (tmpType->type != XML_SCHEMA_TYPE_BASIC));
}
return (error); return (error);
} }