--- embedaddon/mpd/src/ippool.c 2012/02/21 23:32:47 1.1 +++ embedaddon/mpd/src/ippool.c 2021/03/17 00:39:23 1.1.1.2 @@ -28,16 +28,16 @@ struct ippool { typedef struct ippool *IPPool; -SLIST_HEAD(, ippool) gIPPools; -pthread_mutex_t gIPPoolMutex; +static SLIST_HEAD(, ippool) gIPPools; +static pthread_mutex_t gIPPoolMutex; -static void IPPoolAdd(char *pool, struct in_addr begin, struct in_addr end); -static int IPPoolSetCommand(Context ctx, int ac, char *av[], void *arg); +static void IPPoolAdd(const char *pool, struct in_addr begin, struct in_addr end); +static int IPPoolSetCommand(Context ctx, int ac, const char *const av[], const void *arg); const struct cmdtab IPPoolSetCmds[] = { { "add {pool} {start} {end}", "Add IP range to the pool", IPPoolSetCommand, NULL, 2, (void *) SET_ADD }, - { NULL }, + { NULL, NULL, NULL, NULL, 0, NULL }, }; void @@ -105,14 +105,14 @@ void IPPoolFree(char *pool, struct u_addr *ip) { } static void -IPPoolAdd(char *pool, struct in_addr begin, struct in_addr end) +IPPoolAdd(const char *pool, struct in_addr begin, struct in_addr end) { IPPool p; struct ippool_rec *r; int i, j, k; int total; - u_int c = ntohl(end.s_addr) - ntohl(begin.s_addr) + 1; + int c = ntohl(end.s_addr) - ntohl(begin.s_addr) + 1; if (c > 65536) { Log(LG_ERR, ("Too big IP range: %d", c)); @@ -162,10 +162,14 @@ IPPoolAdd(char *pool, struct in_addr begin, struct in_ */ int -IPPoolStat(Context ctx, int ac, char *av[], void *arg) +IPPoolStat(Context ctx, int ac, const char *const av[], const void *arg) { IPPool p; + (void)ac; + (void)av; + (void)arg; + Printf("Available IP pools:\r\n"); MUTEX_LOCK(gIPPoolMutex); SLIST_FOREACH(p, &gIPPools, next) { @@ -190,8 +194,9 @@ IPPoolStat(Context ctx, int ac, char *av[], void *arg) */ static int -IPPoolSetCommand(Context ctx, int ac, char *av[], void *arg) +IPPoolSetCommand(Context ctx, int ac, const char *const av[], const void *arg) { + (void)ctx; switch ((intptr_t)arg) { case SET_ADD: {