[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 1/3] storage_conf: Break long line and polish coding style



On 2012年07月09日 21:21, Peter Krempa wrote:
---
  src/conf/storage_conf.c          |   12 ++++++------
  src/storage/storage_backend_fs.c |    3 +--
  2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index bf4567f..ab8df9e 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -593,19 +593,19 @@ virStoragePoolDefParseSourceString(const char *srcSpec,
      xmlXPathContextPtr xpath_ctxt = NULL;
      virStoragePoolSourcePtr def = NULL, ret = NULL;

-    if (!(doc = virXMLParseStringCtxt(srcSpec, _("(storage_source_specification)"),&xpath_ctxt))) {
+    if (!(doc = virXMLParseStringCtxt(srcSpec,
+                                      _("(storage_source_specification)"),
+&xpath_ctxt)))
          goto cleanup;
-    }

      if (VIR_ALLOC(def)<  0) {
          virReportOOMError();
          goto cleanup;
      }

-    node = virXPathNode("/source", xpath_ctxt);
-    if (!node) {
-        virStorageReportError(VIR_ERR_XML_ERROR,
-                              "%s", _("root element was not source"));
+    if (!(node = virXPathNode("/source", xpath_ctxt))) {
+        virStorageReportError(VIR_ERR_XML_ERROR, "%s",
+                              _("root element was not source"));
          goto cleanup;
      }

diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index 87d9192..c736496 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -190,8 +190,7 @@ virStorageBackendFileSystemNetFindPoolSourcesFunc(virStoragePoolObjPtr pool ATTR

      path = groups[0];

-    name = strrchr(path, '/');
-    if (name == NULL) {
+    if (!(name = strrchr(path, '/'))) {
          virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                                _("invalid netfs path (no /): %s"), path);
          goto cleanup;

ACK


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]