From 6cb7ad8d0bd51e178ec25222251d2e842b9e5aa0 Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <shemminger@vyatta.com>
Date: Wed, 11 Jul 2012 12:03:56 -0700
Subject: Minor code cleanup

1. Make local functions static
2. Use C standard for function with no-args versus old K&R style
3. Make some arguments const
---
 src/common/unionfs.c | 28 ++++++++++++++--------------
 src/common/unionfs.h |  2 +-
 2 files changed, 15 insertions(+), 15 deletions(-)

(limited to 'src/common')

diff --git a/src/common/unionfs.c b/src/common/unionfs.c
index 2d8bddd..d8b7626 100644
--- a/src/common/unionfs.c
+++ b/src/common/unionfs.c
@@ -60,7 +60,7 @@ sys_cp(const char *src_file, const char *dst_file)
 }
 
 static inline void
-sys_umount_session()
+sys_umount_session(void)
 {
   if (umount(get_mdirp()) != 0) {
     perror("umount");
@@ -68,7 +68,7 @@ sys_umount_session()
 }
 
 static inline void
-sys_mount_session()
+sys_mount_session(void)
 {
   char mopts[MAX_LENGTH_DIR_PATH * 2];
   snprintf(mopts, MAX_LENGTH_DIR_PATH * 2, "dirs=%s=rw:%s=ro",
@@ -81,16 +81,16 @@ sys_mount_session()
 void
 set_path(char *path, boolean config);
 
-struct VyattaNode*
+static struct VyattaNode*
 copy_vyatta_node(struct VyattaNode* vn);
 
-void
+static void
 get_term_data_values(GNode *node);
 
-void
+static void
 dlist_test_func(GQuark key_id,gpointer data,gpointer user_data);
 
-GNode*
+static GNode*
 insert_sibling_in_order(GNode *parent, GNode *child);
 
 static gboolean
@@ -119,7 +119,7 @@ piecewise_copy(GNode *root_node, boolean test_mode);
  *
  * This should allow a combined data/config tree
  **/
-char*
+static char *
 get_config_path(GNode *node)
 {
   if (node == NULL) {
@@ -168,7 +168,7 @@ get_config_path(GNode *node)
 /**
  *
  **/
-void
+static void
 retrieve_data(char* rel_data_path, GNode *node, const char* root, 
               NODE_OPERATION op)
 {
@@ -514,7 +514,7 @@ retrieve_data(char* rel_data_path, GNode *node, const char* root,
  *
  **/
 GNode*
-common_get_local_session_data()
+common_get_local_session_data(void)
 {
   //get root directory
   char *data_path = malloc(sizeof(char)*MAX_LENGTH_DIR_PATH);
@@ -541,7 +541,7 @@ common_get_local_session_data()
  *
  **/
 boolean
-value_exists(char *path)
+value_exists(const char *path)
 {
   char buf[MAX_LENGTH_DIR_PATH];
   sprintf(buf, "%s/%s",path,VAL_NAME);
@@ -887,7 +887,7 @@ common_commit_clean_temp_config(GNode *root_node, boolean test_mode)
 /**
  *
  **/
-struct VyattaNode*
+static struct VyattaNode*
 copy_vyatta_node(struct VyattaNode* vn)
 {
   struct VyattaNode *new_vn = calloc(1,sizeof(struct VyattaNode));
@@ -919,7 +919,7 @@ copy_vyatta_node(struct VyattaNode* vn)
 /**
  *
  **/
-void
+static void
 get_term_data_values(GNode *node)
 {
   struct VyattaNode* vn = (struct VyattaNode*)node->data;
@@ -1020,7 +1020,7 @@ get_term_data_values(GNode *node)
 /**
  *
  **/
-void
+static void
 dlist_test_func(GQuark key_id,gpointer data,gpointer user_data)
 {
   if (key_id == 0) {
@@ -1079,7 +1079,7 @@ dlist_test_func(GQuark key_id,gpointer data,gpointer user_data)
 /**
  *
  **/
-GNode*
+static GNode*
 insert_sibling_in_order(GNode *parent, GNode *child)
 {
   //find alphabetical order to insert child into sibling
diff --git a/src/common/unionfs.h b/src/common/unionfs.h
index 6437e2a..8ce50af 100644
--- a/src/common/unionfs.h
+++ b/src/common/unionfs.h
@@ -20,7 +20,7 @@ extern "C" {
 #define MAX_LENGTH_HELP_STR 4096
 
 boolean
-value_exists(char *path);
+value_exists(const char *path);
 
 struct PriData {
   unsigned long _pri;
-- 
cgit v1.2.3