mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2025-01-03 14:56:34 -05:00
Cleanup: Corrected code style
This commit is contained in:
parent
d1e35f6457
commit
79d16e9b21
48
src/stats.c
48
src/stats.c
@ -442,16 +442,15 @@ static void modify_node_event(stats_node_t *node, stats_event_t *event)
|
||||
{
|
||||
char *str;
|
||||
|
||||
if (event->action == STATS_EVENT_HIDDEN)
|
||||
{
|
||||
if (event->action == STATS_EVENT_HIDDEN) {
|
||||
if (event->value)
|
||||
node->hidden = 1;
|
||||
else
|
||||
node->hidden = 0;
|
||||
return;
|
||||
}
|
||||
if (event->action != STATS_EVENT_SET)
|
||||
{
|
||||
|
||||
if (event->action != STATS_EVENT_SET) {
|
||||
int64_t value = 0;
|
||||
|
||||
switch (event->action)
|
||||
@ -476,16 +475,17 @@ static void modify_node_event(stats_node_t *node, stats_event_t *event)
|
||||
snprintf(str, 16, "%" PRId64, value);
|
||||
if (event->value == NULL)
|
||||
event->value = strdup(str);
|
||||
}
|
||||
else
|
||||
} else {
|
||||
str = (char *)strdup(event->value);
|
||||
}
|
||||
free(node->value);
|
||||
node->value = str;
|
||||
if (event->source)
|
||||
if (event->source) {
|
||||
ICECAST_LOG_DEBUG("update \"%s\" %s (%s)", event->source, node->name, node->value);
|
||||
else
|
||||
} else {
|
||||
ICECAST_LOG_DEBUG("update global %s (%s)", node->name, node->value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void process_global_event (stats_event_t *event)
|
||||
@ -538,16 +538,14 @@ static void process_source_event (stats_event_t *event)
|
||||
|
||||
avl_insert(_stats.source_tree, (void *) snode);
|
||||
}
|
||||
if (event->name)
|
||||
{
|
||||
|
||||
if (event->name) {
|
||||
stats_node_t *node = _find_node(snode->stats_tree, event->name);
|
||||
if (node == NULL)
|
||||
{
|
||||
if (node == NULL) {
|
||||
if (event->action == STATS_EVENT_REMOVE)
|
||||
return;
|
||||
/* adding node */
|
||||
if (event->value)
|
||||
{
|
||||
if (event->value) {
|
||||
ICECAST_LOG_DEBUG("new node %s (%s)", event->name, event->value);
|
||||
node = (stats_node_t *)calloc(1,sizeof(stats_node_t));
|
||||
node->name = (char *)strdup(event->name);
|
||||
@ -558,8 +556,8 @@ static void process_source_event (stats_event_t *event)
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (event->action == STATS_EVENT_REMOVE)
|
||||
{
|
||||
|
||||
if (event->action == STATS_EVENT_REMOVE) {
|
||||
ICECAST_LOG_DEBUG("delete node %s", event->name);
|
||||
avl_delete(snode->stats_tree, (void *)node, _free_stats);
|
||||
return;
|
||||
@ -567,24 +565,26 @@ static void process_source_event (stats_event_t *event)
|
||||
modify_node_event(node, event);
|
||||
return;
|
||||
}
|
||||
if (event->action == STATS_EVENT_HIDDEN)
|
||||
{
|
||||
|
||||
if (event->action == STATS_EVENT_HIDDEN) {
|
||||
avl_node *node = avl_get_first (snode->stats_tree);
|
||||
|
||||
if (event->value)
|
||||
if (event->value) {
|
||||
snode->hidden = 1;
|
||||
else
|
||||
} else {
|
||||
snode->hidden = 0;
|
||||
while (node)
|
||||
{
|
||||
}
|
||||
|
||||
while (node) {
|
||||
stats_node_t *stats = (stats_node_t*)node->key;
|
||||
stats->hidden = snode->hidden;
|
||||
node = avl_get_next(node);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
if (event->action == STATS_EVENT_REMOVE)
|
||||
{
|
||||
|
||||
if (event->action == STATS_EVENT_REMOVE) {
|
||||
ICECAST_LOG_DEBUG("delete source node %s", event->source);
|
||||
avl_delete(_stats.source_tree, (void *)snode, _free_source_stats);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user