Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
b84a7ea0
Commit
b84a7ea0
authored
Nov 25, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
objects: inline NewList() and fix error case
parent
d1f507fb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
33 deletions
+21
-33
src/misc/objects.c
src/misc/objects.c
+21
-33
No files found.
src/misc/objects.c
View file @
b84a7ea0
...
...
@@ -66,8 +66,6 @@ static vlc_object_t * FindName ( vlc_object_internals_t *, const char * );
static
void
PrintObject
(
vlc_object_internals_t
*
,
const
char
*
);
static
void
DumpStructure
(
vlc_object_internals_t
*
,
unsigned
,
char
*
);
static
vlc_list_t
*
NewList
(
int
);
static
void
vlc_object_destroy
(
vlc_object_t
*
p_this
);
/*****************************************************************************
...
...
@@ -384,21 +382,35 @@ void vlc_object_release( vlc_object_t *p_this )
*/
vlc_list_t
*
vlc_list_children
(
vlc_object_t
*
obj
)
{
vlc_list_t
*
l
;
vlc_list_t
*
l
=
malloc
(
sizeof
(
*
l
));
if
(
unlikely
(
l
==
NULL
))
return
NULL
;
l
->
i_count
=
0
;
l
->
p_values
=
NULL
;
vlc_object_internals_t
*
priv
;
unsigned
count
=
0
;
libvlc_lock
(
obj
->
p_libvlc
);
for
(
priv
=
vlc_internals
(
obj
)
->
first
;
priv
;
priv
=
priv
->
next
)
count
++
;
l
=
NewList
(
count
);
if
(
likely
(
l
!=
NULL
))
if
(
count
>
0
)
{
l
->
p_values
=
malloc
(
count
*
sizeof
(
vlc_value_t
));
if
(
unlikely
(
l
->
p_values
==
NULL
))
{
libvlc_unlock
(
obj
->
p_libvlc
);
free
(
l
);
return
NULL
;
}
}
unsigned
i
=
0
;
for
(
priv
=
vlc_internals
(
obj
)
->
first
;
priv
;
priv
=
priv
->
next
)
l
->
p_values
[
i
++
].
p_address
=
vlc_object_hold
(
vlc_externals
(
priv
));
}
libvlc_unlock
(
obj
->
p_libvlc
);
return
l
;
}
...
...
@@ -549,27 +561,3 @@ static void DumpStructure (vlc_object_internals_t *priv, unsigned i_level,
DumpStructure
(
priv
,
i_level
+
2
,
psz_foo
);
}
}
static
vlc_list_t
*
NewList
(
int
i_count
)
{
vlc_list_t
*
p_list
=
malloc
(
sizeof
(
vlc_list_t
)
);
if
(
p_list
==
NULL
)
return
NULL
;
p_list
->
i_count
=
i_count
;
if
(
i_count
==
0
)
{
p_list
->
p_values
=
NULL
;
return
p_list
;
}
p_list
->
p_values
=
malloc
(
i_count
*
sizeof
(
vlc_value_t
)
);
if
(
p_list
->
p_values
==
NULL
)
{
p_list
->
i_count
=
0
;
return
p_list
;
}
return
p_list
;
}
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