[libvirt] [PATCHv2 03/10] nodeinfo: Avoid forward declarations of static functions

Peter Krempa pkrempa at redhat.com
Fri Oct 18 15:05:43 UTC 2013


linuxNodeGetCPUStats() and linuxNodeGetMemoryStats() are static and
don't need a forward declaration.
---
 src/nodeinfo.c | 27 ++++++++++-----------------
 1 file changed, 10 insertions(+), 17 deletions(-)

diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index d4bb792..803856b 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -89,15 +89,6 @@ appleFreebsdNodeGetCPUCount(void)
 # define LINUX_NB_MEMORY_STATS_ALL 4
 # define LINUX_NB_MEMORY_STATS_CELL 2

-static int linuxNodeGetCPUStats(FILE *procstat,
-                                int cpuNum,
-                                virNodeCPUStatsPtr params,
-                                int *nparams);
-static int linuxNodeGetMemoryStats(FILE *meminfo,
-                                   int cellNum,
-                                   virNodeMemoryStatsPtr params,
-                                   int *nparams);
-
 /* Return the positive decimal contents of the given
  * DIR/cpu%u/FILE, or -1 on error.  If DEFAULT_VALUE is non-negative
  * and the file could not be found, return that instead of an error;
@@ -586,10 +577,11 @@ cleanup:

 # define TICK_TO_NSEC (1000ull * 1000ull * 1000ull / sysconf(_SC_CLK_TCK))

-int linuxNodeGetCPUStats(FILE *procstat,
-                         int cpuNum,
-                         virNodeCPUStatsPtr params,
-                         int *nparams)
+static int
+linuxNodeGetCPUStats(FILE *procstat,
+                     int cpuNum,
+                     virNodeCPUStatsPtr params,
+                     int *nparams)
 {
     int ret = -1;
     char line[1024];
@@ -689,10 +681,11 @@ cleanup:
     return ret;
 }

-int linuxNodeGetMemoryStats(FILE *meminfo,
-                            int cellNum,
-                            virNodeMemoryStatsPtr params,
-                            int *nparams)
+static int
+linuxNodeGetMemoryStats(FILE *meminfo,
+                        int cellNum,
+                        virNodeMemoryStatsPtr params,
+                        int *nparams)
 {
     int ret = -1;
     size_t i = 0, j = 0, k = 0;
-- 
1.8.3.2




More information about the libvir-list mailing list