Re: [PATCH 8/8] src: drop some forward declarations in src/storage/storage_backend_sheepdog.c

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

 



On 3/27/21 3:54 AM, peili wrote:
---
  src/storage/storage_backend_sheepdog.c | 6 ------
  1 file changed, 6 deletions(-)

diff --git a/src/storage/storage_backend_sheepdog.c b/src/storage/storage_backend_sheepdog.c
index 8c37947308..010e86aa14 100644
--- a/src/storage/storage_backend_sheepdog.c
+++ b/src/storage/storage_backend_sheepdog.c
@@ -35,12 +35,6 @@
#define VIR_FROM_THIS VIR_FROM_STORAGE -static int virStorageBackendSheepdogRefreshVol(virStoragePoolObjPtr pool,
-                                               virStorageVolDefPtr vol);
-
-void virStorageBackendSheepdogAddHostArg(virCommandPtr cmd,
-                                         virStoragePoolObjPtr pool);
-
  int
  virStorageBackendSheepdogParseNodeInfo(virStoragePoolDefPtr pool,
                                         char *output)


Unfortunately, dropping forward declarations is not that easy. For instance in the following example:

int foo() {
  ...
  bar();
  ...
}


int bar() {
  ...
  foo();
  ...
}


This block has to be prefaced with forward declaration of bar() because as compiler parses the input, it sees foo() (among with it declaration), and then it sees bar() being called, but since it did not see its declaration yet, it can't ensure that arguments passed are correct type, correct count, ...; therefore, bar() has to be declared before before foo().

However, consider the following case:

int foo() {
  ...
  // no bar() call here
  ...
}


int bar() {
  ...
  foo();
  ...
}

here, function foo() does NOT call bar() and therefore, there is no need for forward declaration of bar().

Michal




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux