summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhao, Gang <gang.zhao.42@gmail.com>2016-02-26 17:18:38 +0800
committerFelix Fietkau <nbd@openwrt.org>2016-02-29 21:06:28 +0100
commit6cd8912f102e721ea10ac13a1885fb9127cb4951 (patch)
treec52875424f1a2973a05ebb8459f2c74898b750cb
parent5dfd3c16fa1cc9e288c41ef6e3e4c3bc63acf612 (diff)
downloadubus-6cd8912f102e721ea10ac13a1885fb9127cb4951.tar.gz
cli: static keyword tweak
Function ubus_cli_listen() is called only once, and function uloop_run() and uloop_done() which need struct ubus_event_handler listener are called within this function, so it's not needed to mark struct ubus_event_handler listener as static. The same as pointer struct ubus_context *ctx in main function. Global struct commands is only used in this file, so it should be marked static. Signed-off-by: Zhao, Gang <gang.zhao.42@gmail.com>
-rw-r--r--cli.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/cli.c b/cli.c
index 98fc4fe..eea43e3 100644
--- a/cli.c
+++ b/cli.c
@@ -142,7 +142,7 @@ static int ubus_cli_call(struct ubus_context *ctx, int argc, char **argv)
static int ubus_cli_listen(struct ubus_context *ctx, int argc, char **argv)
{
- static struct ubus_event_handler listener;
+ struct ubus_event_handler listener;
const char *event;
int ret = 0;
@@ -479,7 +479,7 @@ static int usage(const char *prog)
}
-struct {
+static struct {
const char *name;
int (*cb)(struct ubus_context *ctx, int argc, char **argv);
} commands[] = {
@@ -494,7 +494,7 @@ struct {
int main(int argc, char **argv)
{
const char *progname, *ubus_socket = NULL;
- static struct ubus_context *ctx;
+ struct ubus_context *ctx;
char *cmd;
int ret = 0;
int i, ch;