diff options
author | Gao Feng <davidfgao@tencent.com> | 2018-12-20 14:47:49 +0800 |
---|---|---|
committer | Gao Feng <davidfgao@tencent.com> | 2018-12-20 14:47:49 +0800 |
commit | e02b24ee7e41a14293e73d6c6ee4ec87448c44c0 (patch) | |
tree | 27c4ba3d282aa288ad59825d3a15c3f7a1802eac /src | |
parent | ba089324594f450a1b549906ec7fde1ba63a1e89 (diff) |
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 <davidfgao@tencent.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/sc_plugins.c | 11 |
1 files changed, 3 insertions, 8 deletions
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); } |