From e02b24ee7e41a14293e73d6c6ee4ec87448c44c0 Mon Sep 17 00:00:00 2001 From: Gao Feng Date: Thu, 20 Dec 2018 14:47:49 +0800 Subject: Refactor the file sc_plugins.c 1. It's better to check the return value of sc_connect_vpp with 0, not -1. 2. Eliminate the warnings when compiling the file sc_plugins.c. Change-Id: I2c5b4aa4f06f9f6367bea96c26254b68b7da3a02 Signed-off-by: Gao Feng --- src/plugins/sc_plugins.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/plugins/sc_plugins.c b/src/plugins/sc_plugins.c index d1271ca..1bf27ea 100644 --- a/src/plugins/sc_plugins.c +++ b/src/plugins/sc_plugins.c @@ -41,9 +41,9 @@ int sr_plugin_init_cb(sr_session_ctx_t *session, void **private_ctx) sr_subscription_ctx_t *subscription = NULL; int rc = SR_ERR_OK; rc = sc_connect_vpp(); - if (-1 == rc) + if (0 != rc) { - SC_LOG_ERR("vpp connect error , with return %d.", SR_ERR_INTERNAL); + SC_LOG_ERR("vpp connect error , with return %d.", rc); return SR_ERR_INTERNAL; } @@ -97,18 +97,14 @@ int subscribe_all_module_events(sr_session_ctx_t *session) { sr_plugin_init_cb(session, (void**)&subscription); - + return 0; } int main(int argc, char **argv) { sr_conn_ctx_t *connection = NULL; sr_session_ctx_t *session = NULL; - int time_now; - int reg_time; - time_t now; int rc = SR_ERR_OK; - int i = 0; /* connect to vpp */ rc = sc_connect_vpp(); @@ -142,7 +138,6 @@ main(int argc, char **argv) signal(SIGINT, sigint_handler); signal(SIGPIPE, SIG_IGN); - int loopCount = 11; while (!exit_application) { sleep(2); } -- cgit 1.2.3-korg