mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-15 01:43:40 -06:00
Also detect and remove unnecessary if-before-xmlXPathFreeContext.
* build-aux/find-unnecessary-if-before-free: Update regexp. * src/openvz_conf.c: Remove unnecessary "if (P)"-before xmlXPathFreeContext. * src/qemu_conf.c: Likewise. * src/virsh.c: Likewise. * src/xm_internal.c: Likewise. * src/xml.c: Likewise. * tests/xmlrpctest.c: Likewise.
This commit is contained in:
parent
1be2c8c814
commit
2367caa327
@ -1,5 +1,14 @@
|
|||||||
Tue Jan 29 18:39:25 CET 2008 Jim Meyering <meyering@redhat.com>
|
Tue Jan 29 18:39:25 CET 2008 Jim Meyering <meyering@redhat.com>
|
||||||
|
|
||||||
|
Also detect and remove unnecessary if-before-xmlXPathFreeContext.
|
||||||
|
* build-aux/find-unnecessary-if-before-free: Update regexp.
|
||||||
|
* src/virsh.c: Remove unnecessary "if (P)"-before xmlXPathFreeContext.
|
||||||
|
* src/openvz_conf.c: Likewise.
|
||||||
|
* src/qemu_conf.c: Likewise.
|
||||||
|
* src/xm_internal.c: Likewise.
|
||||||
|
* src/xml.c: Likewise.
|
||||||
|
* tests/xmlrpctest.c: Likewise.
|
||||||
|
|
||||||
Enable two more tests.
|
Enable two more tests.
|
||||||
* Makefile.cfg (local-checks-to-skip)
|
* Makefile.cfg (local-checks-to-skip)
|
||||||
[sc_cast_of_x_alloc_return_value, sc_cast_of_argument_to_free]: Enable.
|
[sc_cast_of_x_alloc_return_value, sc_cast_of_argument_to_free]: Enable.
|
||||||
|
@ -22,7 +22,7 @@ use warnings;
|
|||||||
{
|
{
|
||||||
if ($line =~
|
if ($line =~
|
||||||
/\b(if\s*\(\s*(\S+?)(?:\s*!=\s*NULL)?\s*\)
|
/\b(if\s*\(\s*(\S+?)(?:\s*!=\s*NULL)?\s*\)
|
||||||
\s+(?:sexpr_)?free\s*\(\s*\2\s*\))/sx)
|
\s+(?:xmlXPathFreeContext|(?:sexpr_)?free)\s*\(\s*\2\s*\))/sx)
|
||||||
{
|
{
|
||||||
print "$file: $1\n";
|
print "$file: $1\n";
|
||||||
$found_match = 1;
|
$found_match = 1;
|
||||||
@ -37,6 +37,6 @@ my $foo = <<'EOF';
|
|||||||
# The above is to *find* them.
|
# The above is to *find* them.
|
||||||
# This adjusts them, removing the unnecessary "if (p)" part.
|
# This adjusts them, removing the unnecessary "if (p)" part.
|
||||||
|
|
||||||
git ls-files -z |xargs -0 \
|
git ls-files -z --exclude=find-unnecessary-if-before-free |xargs -0 \
|
||||||
perl -0x3b -pi -e 's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*NULL)?\s*\)\s+((?:sexpr_)?free\s*\(\s*\1\s*\))/$2/s'
|
perl -0x3b -pi -e 's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*NULL)?\s*\)\s+((?:xmlXPathFreeContext|(?:sexpr_)?free)\s*\(\s*\1\s*\))/$2/s'
|
||||||
EOF
|
EOF
|
||||||
|
@ -497,7 +497,6 @@ static struct openvz_vm_def
|
|||||||
free(prop);
|
free(prop);
|
||||||
if (obj)
|
if (obj)
|
||||||
xmlXPathFreeObject(obj);
|
xmlXPathFreeObject(obj);
|
||||||
if (ctxt)
|
|
||||||
xmlXPathFreeContext(ctxt);
|
xmlXPathFreeContext(ctxt);
|
||||||
openvzFreeVMDef(def);
|
openvzFreeVMDef(def);
|
||||||
|
|
||||||
|
@ -1382,7 +1382,6 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
|
|||||||
free(prop);
|
free(prop);
|
||||||
if (obj)
|
if (obj)
|
||||||
xmlXPathFreeObject(obj);
|
xmlXPathFreeObject(obj);
|
||||||
if (ctxt)
|
|
||||||
xmlXPathFreeContext(ctxt);
|
xmlXPathFreeContext(ctxt);
|
||||||
qemudFreeVMDef(def);
|
qemudFreeVMDef(def);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -2392,7 +2391,6 @@ static struct qemud_network_def *qemudParseNetworkXML(virConnectPtr conn,
|
|||||||
xmlXPathFreeObject(obj);
|
xmlXPathFreeObject(obj);
|
||||||
if (tmp)
|
if (tmp)
|
||||||
xmlXPathFreeObject(tmp);
|
xmlXPathFreeObject(tmp);
|
||||||
if (ctxt)
|
|
||||||
xmlXPathFreeContext(ctxt);
|
xmlXPathFreeContext(ctxt);
|
||||||
qemudFreeNetworkDef(def);
|
qemudFreeNetworkDef(def);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -504,7 +504,6 @@ cmdConsole(vshControl * ctl, vshCmd * cmd)
|
|||||||
xmlXPathFreeObject(obj);
|
xmlXPathFreeObject(obj);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (ctxt)
|
|
||||||
xmlXPathFreeContext(ctxt);
|
xmlXPathFreeContext(ctxt);
|
||||||
if (xml)
|
if (xml)
|
||||||
xmlFreeDoc(xml);
|
xmlFreeDoc(xml);
|
||||||
@ -2932,7 +2931,6 @@ cmdVNCDisplay(vshControl * ctl, vshCmd * cmd)
|
|||||||
cleanup:
|
cleanup:
|
||||||
if (obj)
|
if (obj)
|
||||||
xmlXPathFreeObject(obj);
|
xmlXPathFreeObject(obj);
|
||||||
if (ctxt)
|
|
||||||
xmlXPathFreeContext(ctxt);
|
xmlXPathFreeContext(ctxt);
|
||||||
if (xml)
|
if (xml)
|
||||||
xmlFreeDoc(xml);
|
xmlFreeDoc(xml);
|
||||||
@ -2995,7 +2993,6 @@ cmdTTYConsole(vshControl * ctl, vshCmd * cmd)
|
|||||||
cleanup:
|
cleanup:
|
||||||
if (obj)
|
if (obj)
|
||||||
xmlXPathFreeObject(obj);
|
xmlXPathFreeObject(obj);
|
||||||
if (ctxt)
|
|
||||||
xmlXPathFreeContext(ctxt);
|
xmlXPathFreeContext(ctxt);
|
||||||
if (xml)
|
if (xml)
|
||||||
xmlFreeDoc(xml);
|
xmlFreeDoc(xml);
|
||||||
@ -3337,7 +3334,6 @@ cmdDetachInterface(vshControl * ctl, vshCmd * cmd)
|
|||||||
virDomainFree(dom);
|
virDomainFree(dom);
|
||||||
if (obj)
|
if (obj)
|
||||||
xmlXPathFreeObject(obj);
|
xmlXPathFreeObject(obj);
|
||||||
if (ctxt)
|
|
||||||
xmlXPathFreeContext(ctxt);
|
xmlXPathFreeContext(ctxt);
|
||||||
if (xml)
|
if (xml)
|
||||||
xmlFreeDoc(xml);
|
xmlFreeDoc(xml);
|
||||||
@ -3611,7 +3607,6 @@ cmdDetachDisk(vshControl * ctl, vshCmd * cmd)
|
|||||||
cleanup:
|
cleanup:
|
||||||
if (obj)
|
if (obj)
|
||||||
xmlXPathFreeObject(obj);
|
xmlXPathFreeObject(obj);
|
||||||
if (ctxt)
|
|
||||||
xmlXPathFreeContext(ctxt);
|
xmlXPathFreeContext(ctxt);
|
||||||
if (xml)
|
if (xml)
|
||||||
xmlFreeDoc(xml);
|
xmlFreeDoc(xml);
|
||||||
|
@ -2273,7 +2273,6 @@ virConfPtr xenXMParseXMLToConfig(virConnectPtr conn, const char *xml) {
|
|||||||
xmlFree(prop);
|
xmlFree(prop);
|
||||||
if (obj != NULL)
|
if (obj != NULL)
|
||||||
xmlXPathFreeObject(obj);
|
xmlXPathFreeObject(obj);
|
||||||
if (ctxt != NULL)
|
|
||||||
xmlXPathFreeContext(ctxt);
|
xmlXPathFreeContext(ctxt);
|
||||||
if (doc != NULL)
|
if (doc != NULL)
|
||||||
xmlFreeDoc(doc);
|
xmlFreeDoc(doc);
|
||||||
|
@ -1795,7 +1795,6 @@ virDomainParseXMLDesc(virConnectPtr conn, const char *xmldesc, char **name,
|
|||||||
free(nam);
|
free(nam);
|
||||||
if (name != NULL)
|
if (name != NULL)
|
||||||
*name = NULL;
|
*name = NULL;
|
||||||
if (ctxt != NULL)
|
|
||||||
xmlXPathFreeContext(ctxt);
|
xmlXPathFreeContext(ctxt);
|
||||||
if (xml != NULL)
|
if (xml != NULL)
|
||||||
xmlFreeDoc(xml);
|
xmlFreeDoc(xml);
|
||||||
|
@ -121,7 +121,6 @@ checkRequestValue(const char *xmlstr, const char *xpath, int type, void *expecte
|
|||||||
error:
|
error:
|
||||||
if (obj)
|
if (obj)
|
||||||
xmlXPathFreeObject(obj);
|
xmlXPathFreeObject(obj);
|
||||||
if (ctxt)
|
|
||||||
xmlXPathFreeContext(ctxt);
|
xmlXPathFreeContext(ctxt);
|
||||||
if (xml)
|
if (xml)
|
||||||
xmlFreeDoc(xml);
|
xmlFreeDoc(xml);
|
||||||
|
Loading…
Reference in New Issue
Block a user