Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Icecast-Server
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
93
Issues
93
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
External Wiki
External Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xiph.Org
Icecast-Server
Commits
a242f0f7
Commit
a242f0f7
authored
Oct 11, 2018
by
Philipp Schafft
🦁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update: Replaced reportxml_new() and reportxml_database_new()
parent
fea817da
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
35 deletions
+41
-35
src/cfgfile.c
src/cfgfile.c
+1
-1
src/client.c
src/client.c
+1
-1
src/reportxml.c
src/reportxml.c
+33
-31
src/reportxml.h
src/reportxml.h
+6
-2
No files found.
src/cfgfile.c
View file @
a242f0f7
...
...
@@ -232,7 +232,7 @@ void config_init_configuration(ice_config_t *configuration)
{
memset
(
configuration
,
0
,
sizeof
(
ice_config_t
));
_set_defaults
(
configuration
);
configuration
->
reportxml_db
=
re
portxml_database_new
(
);
configuration
->
reportxml_db
=
re
fobject_new
(
reportxml_database_t
);
}
static
inline
void
__read_int
(
xmlDocPtr
doc
,
xmlNodePtr
node
,
int
*
val
,
const
char
*
warning
)
...
...
src/client.c
View file @
a242f0f7
...
...
@@ -661,7 +661,7 @@ reportxml_t *client_get_reportxml(const char *state_definition, const char *stat
if
(
!
report
)
{
reportxml_node_t
*
rootnode
,
*
incidentnode
,
*
statenode
;
report
=
re
portxml_new
(
);
report
=
re
fobject_new
(
reportxml_t
);
rootnode
=
reportxml_get_root_node
(
report
);
incidentnode
=
reportxml_node_new
(
REPORTXML_NODE_TYPE_INCIDENT
,
NULL
,
NULL
,
NULL
);
statenode
=
reportxml_node_new
(
REPORTXML_NODE_TYPE_STATE
,
NULL
,
state_definition
,
state_akindof
);
...
...
src/reportxml.c
View file @
a242f0f7
...
...
@@ -236,8 +236,22 @@ static void __report_free(refobject_t self, void **userdata)
refobject_unref
(
report
->
root
);
}
static
int
__report_new
(
refobject_t
self
,
const
refobject_type_t
*
type
,
va_list
ap
)
{
reportxml_t
*
ret
=
REFOBJECT_TO_TYPE
(
self
,
reportxml_t
*
);
reportxml_node_t
*
root
=
reportxml_node_new
(
REPORTXML_NODE_TYPE_REPORT
,
NULL
,
NULL
,
NULL
);
if
(
!
root
)
return
-
1
;
ret
->
root
=
root
;
return
0
;
}
REFOBJECT_DEFINE_TYPE
(
reportxml_t
,
REFOBJECT_DEFINE_TYPE_FREE
(
__report_free
)
REFOBJECT_DEFINE_TYPE_FREE
(
__report_free
),
REFOBJECT_DEFINE_TYPE_NEW
(
__report_new
)
);
static
reportxml_t
*
reportxml_new_with_root
(
reportxml_node_t
*
root
)
...
...
@@ -255,20 +269,7 @@ static reportxml_t * reportxml_new_with_root(reportxml_node_t *root)
reportxml_t
*
reportxml_new
(
void
)
{
reportxml_node_t
*
root
=
reportxml_node_new
(
REPORTXML_NODE_TYPE_REPORT
,
NULL
,
NULL
,
NULL
);
reportxml_t
*
ret
;
if
(
!
root
)
return
NULL
;
ret
=
reportxml_new_with_root
(
root
);
if
(
!
ret
)
{
refobject_unref
(
root
);
return
NULL
;
}
return
ret
;
return
refobject_new
(
reportxml_t
);
}
reportxml_node_t
*
reportxml_get_root_node
(
reportxml_t
*
report
)
...
...
@@ -983,26 +984,27 @@ static int __compare_definitions(void *arg, void *a, void *b)
return
ret
;
}
REFOBJECT_DEFINE_TYPE
(
reportxml_database_t
,
REFOBJECT_DEFINE_TYPE_FREE
(
__database_free
)
);
reportxml_database_t
*
reportxml_database_new
(
void
)
static
int
__database_new
(
refobject_t
self
,
const
refobject_type_t
*
type
,
va_list
ap
)
{
reportxml_database_t
*
ret
=
refobject_new__new
(
reportxml_database_t
,
NULL
,
NULL
,
NULL
);
reportxml_database_t
*
ret
=
REFOBJECT_TO_TYPE
(
self
,
reportxml_database_t
*
);
if
(
!
ret
)
return
NULL
;
thread_mutex_create
(
&
(
ret
->
lock
));
ret
->
definitions
=
avl_tree_new
(
__compare_definitions
,
NULL
);
if
(
!
ret
->
definitions
)
{
refobject_unref
(
ret
);
return
NULL
;
}
if
(
!
ret
->
definitions
)
return
-
1
;
thread_mutex_create
(
&
(
ret
->
lock
));
return
0
;
}
return
ret
;
REFOBJECT_DEFINE_TYPE
(
reportxml_database_t
,
REFOBJECT_DEFINE_TYPE_FREE
(
__database_free
),
REFOBJECT_DEFINE_TYPE_NEW
(
__database_new
)
);
reportxml_database_t
*
reportxml_database_new
(
void
)
{
return
refobject_new
(
reportxml_database_t
);
}
int
reportxml_database_add_report
(
reportxml_database_t
*
db
,
reportxml_t
*
report
)
...
...
@@ -1305,7 +1307,7 @@ reportxml_t * reportxml_database_build_report(reportxml_database_t *db
/* Empty definition? Not exactly an exciting report... */
ICECAST_LOG_WARN
(
"Empty definition for
\"
%H
\"
. Returning empty report. This is likely an error."
,
id
);
refobject_unref
(
definition
);
return
re
portxml_new
(
);
return
re
fobject_new
(
reportxml_t
);
}
if
(
type
==
REPORTXML_NODE_TYPE__ERROR
)
{
...
...
@@ -1333,7 +1335,7 @@ reportxml_t * reportxml_database_build_report(reportxml_database_t *db
break
;
}
ret
=
re
portxml_new
(
);
ret
=
re
fobject_new
(
reportxml_t
);
if
(
!
ret
)
{
refobject_unref
(
definition
);
ICECAST_LOG_ERROR
(
"Can not allocate new report. BAD."
);
...
...
src/reportxml.h
View file @
a242f0f7
...
...
@@ -68,7 +68,9 @@ REFOBJECT_FORWARD_TYPE(reportxml_database_t);
/* ---[ Document level ]--- */
/* The document object is NOT thread safe. */
/* This creates a new, empty report XML document */
/* Depreciated: This creates a new, empty report XML document
* Do NOT use this. Use refobject_new(reportxml_t)
*/
reportxml_t
*
reportxml_new
(
void
);
/* This gets the root node of a report XML document */
reportxml_node_t
*
reportxml_get_root_node
(
reportxml_t
*
report
);
...
...
@@ -128,7 +130,9 @@ xmlNodePtr reportxml_node_get_xml_child(reportxml_node_t *node, siz
/* The database object is thread safe. */
/* Create a new database object */
/* Depreciated: Create a new database object
* Do NOT use this. Use refobject_new(reportxml_database_t)
*/
reportxml_database_t
*
reportxml_database_new
(
void
);
/* Add an report to the database */
int
reportxml_database_add_report
(
reportxml_database_t
*
db
,
reportxml_t
*
report
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment