[xiph-commits] r13649 - icecast/trunk/icecast/src

karl at svn.xiph.org karl at svn.xiph.org
Tue Aug 28 19:01:28 PDT 2007


Author: karl
Date: 2007-08-28 19:01:28 -0700 (Tue, 28 Aug 2007)
New Revision: 13649

Modified:
   icecast/trunk/icecast/src/stats.c
   icecast/trunk/icecast/src/stats.h
Log:
small const update, add NULL check, NULL shouldn't occur here but it's better to play safe


Modified: icecast/trunk/icecast/src/stats.c
===================================================================
--- icecast/trunk/icecast/src/stats.c	2007-08-28 21:35:16 UTC (rev 13648)
+++ icecast/trunk/icecast/src/stats.c	2007-08-29 02:01:28 UTC (rev 13649)
@@ -87,8 +87,8 @@
 static int _free_stats(void *key);
 static int _free_source_stats(void *key);
 static void _add_event_to_queue(stats_event_t *event, event_queue_t *queue);
-static stats_node_t *_find_node(avl_tree *tree, char *name);
-static stats_source_t *_find_source(avl_tree *tree, char *source);
+static stats_node_t *_find_node(avl_tree *tree, const char *name);
+static stats_source_t *_find_source(avl_tree *tree, const char *source);
 static void _free_event(stats_event_t *event);
 static stats_event_t *_get_event_from_queue (event_queue_t *queue);
 
@@ -289,7 +289,7 @@
     stats_event(source, name, buf);
 }
 
-static char *_get_stats(char *source, char *name)
+static char *_get_stats(const char *source, const char *name)
 {
     stats_node_t *stats = NULL;
     stats_source_t *src = NULL;
@@ -313,7 +313,7 @@
     return value;
 }
 
-char *stats_get_value(char *source, char *name)
+char *stats_get_value(const char *source, const char *name)
 {
     return(_get_stats(source, name));
 }
@@ -358,7 +358,7 @@
 /* note: you must call this function only when you have exclusive access
 ** to the avl_tree
 */
-static stats_node_t *_find_node(avl_tree *stats_tree, char *name)
+static stats_node_t *_find_node(avl_tree *stats_tree, const char *name)
 {
     stats_node_t *stats;
     avl_node *node;
@@ -385,7 +385,7 @@
 /* note: you must call this function only when you have exclusive access
 ** to the avl_tree
 */
-static stats_source_t *_find_source(avl_tree *source_tree, char *source)
+static stats_source_t *_find_source(avl_tree *source_tree, const char *source)
 {
     stats_source_t *stats;
     avl_node *node;
@@ -626,6 +626,8 @@
             event = _get_event_from_queue (&_global_event_queue);
             thread_mutex_unlock(&_global_event_mutex);
 
+            if (event == NULL)
+                continue;
             event->next = NULL;
 
             thread_mutex_lock(&_stats_mutex);

Modified: icecast/trunk/icecast/src/stats.h
===================================================================
--- icecast/trunk/icecast/src/stats.h	2007-08-28 21:35:16 UTC (rev 13648)
+++ icecast/trunk/icecast/src/stats.h	2007-08-29 02:01:28 UTC (rev 13649)
@@ -95,7 +95,7 @@
 void stats_transform_xslt(client_t *client, const char *uri);
 void stats_sendxml(client_t *client);
 void stats_get_xml(xmlDocPtr *doc, int show_hidden, const char *show_mount);
-char *stats_get_value(char *source, char *name);
+char *stats_get_value(const char *source, const char *name);
 
 #endif  /* __STATS_H__ */
 



More information about the commits mailing list