mirror of
https://gitlab.gnome.org/GNOME/libxml2
synced 2025-03-28 21:33:13 +00:00
Remove duplicated code in xmlcatalog
Found by Coverity. https://bugzilla.redhat.com/show_bug.cgi?id=1938806
This commit is contained in:
parent
d7f11fd066
commit
91b3d3f95b
35
xmlcatalog.c
35
xmlcatalog.c
@ -214,32 +214,17 @@ static void usershell(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!strcmp(command, "add")) {
|
} else if (!strcmp(command, "add")) {
|
||||||
if (sgml) {
|
if ((nbargs != 3) && (nbargs != 2)) {
|
||||||
if ((nbargs != 3) && (nbargs != 2)) {
|
printf("add requires 2 or 3 arguments\n");
|
||||||
printf("add requires 2 or 3 arguments\n");
|
|
||||||
} else {
|
|
||||||
if (argv[2] == NULL)
|
|
||||||
ret = xmlCatalogAdd(BAD_CAST argv[0], NULL,
|
|
||||||
BAD_CAST argv[1]);
|
|
||||||
else
|
|
||||||
ret = xmlCatalogAdd(BAD_CAST argv[0], BAD_CAST argv[1],
|
|
||||||
BAD_CAST argv[2]);
|
|
||||||
if (ret != 0)
|
|
||||||
printf("add command failed\n");
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if ((nbargs != 3) && (nbargs != 2)) {
|
if (argv[2] == NULL)
|
||||||
printf("add requires 2 or 3 arguments\n");
|
ret = xmlCatalogAdd(BAD_CAST argv[0], NULL,
|
||||||
} else {
|
BAD_CAST argv[1]);
|
||||||
if (argv[2] == NULL)
|
else
|
||||||
ret = xmlCatalogAdd(BAD_CAST argv[0], NULL,
|
ret = xmlCatalogAdd(BAD_CAST argv[0], BAD_CAST argv[1],
|
||||||
BAD_CAST argv[1]);
|
BAD_CAST argv[2]);
|
||||||
else
|
if (ret != 0)
|
||||||
ret = xmlCatalogAdd(BAD_CAST argv[0], BAD_CAST argv[1],
|
printf("add command failed\n");
|
||||||
BAD_CAST argv[2]);
|
|
||||||
if (ret != 0)
|
|
||||||
printf("add command failed\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (!strcmp(command, "del")) {
|
} else if (!strcmp(command, "del")) {
|
||||||
if (nbargs != 1) {
|
if (nbargs != 1) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user