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>
This commit is contained in:
parent
5dfd3c16fa
commit
6cd8912f10
1 changed files with 3 additions and 3 deletions
6
cli.c
6
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 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;
|
const char *event;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
@ -479,7 +479,7 @@ static int usage(const char *prog)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct {
|
static struct {
|
||||||
const char *name;
|
const char *name;
|
||||||
int (*cb)(struct ubus_context *ctx, int argc, char **argv);
|
int (*cb)(struct ubus_context *ctx, int argc, char **argv);
|
||||||
} commands[] = {
|
} commands[] = {
|
||||||
|
@ -494,7 +494,7 @@ struct {
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
const char *progname, *ubus_socket = NULL;
|
const char *progname, *ubus_socket = NULL;
|
||||||
static struct ubus_context *ctx;
|
struct ubus_context *ctx;
|
||||||
char *cmd;
|
char *cmd;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int i, ch;
|
int i, ch;
|
||||||
|
|
Loading…
Reference in a new issue