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
09523e12
Commit
09523e12
authored
Jul 24, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
attachment: remove unnecessary alloc
parent
b93dcabc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
21 deletions
+7
-21
modules/access/attachment.c
modules/access/attachment.c
+7
-21
No files found.
modules/access/attachment.c
View file @
09523e12
...
@@ -54,10 +54,6 @@ vlc_module_end()
...
@@ -54,10 +54,6 @@ vlc_module_end()
/*****************************************************************************
/*****************************************************************************
* Local prototypes
* Local prototypes
*****************************************************************************/
*****************************************************************************/
struct
access_sys_t
{
input_attachment_t
*
a
;
};
static
ssize_t
Read
(
access_t
*
,
uint8_t
*
,
size_t
);
static
ssize_t
Read
(
access_t
*
,
uint8_t
*
,
size_t
);
static
int
Seek
(
access_t
*
,
uint64_t
);
static
int
Seek
(
access_t
*
,
uint64_t
);
static
int
Control
(
access_t
*
,
int
,
va_list
);
static
int
Control
(
access_t
*
,
int
,
va_list
);
...
@@ -66,7 +62,6 @@ static int Control(access_t *, int, va_list);
...
@@ -66,7 +62,6 @@ static int Control(access_t *, int, va_list);
static
int
Open
(
vlc_object_t
*
object
)
static
int
Open
(
vlc_object_t
*
object
)
{
{
access_t
*
access
=
(
access_t
*
)
object
;
access_t
*
access
=
(
access_t
*
)
object
;
access_sys_t
*
sys
;
input_thread_t
*
input
=
access
->
p_input
;
input_thread_t
*
input
=
access
->
p_input
;
if
(
!
input
)
if
(
!
input
)
...
@@ -82,21 +77,13 @@ static int Open(vlc_object_t *object)
...
@@ -82,21 +77,13 @@ static int Open(vlc_object_t *object)
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
/* */
access
->
p_sys
=
sys
=
malloc
(
sizeof
(
*
sys
));
if
(
!
sys
)
{
vlc_input_attachment_Delete
(
a
);
return
VLC_ENOMEM
;
}
sys
->
a
=
a
;
/* */
/* */
access_InitFields
(
access
);
access_InitFields
(
access
);
access
->
pf_read
=
Read
;
access
->
pf_read
=
Read
;
access
->
pf_block
=
NULL
;
access
->
pf_block
=
NULL
;
access
->
pf_control
=
Control
;
access
->
pf_control
=
Control
;
access
->
pf_seek
=
Seek
;
access
->
pf_seek
=
Seek
;
access
->
p_sys
=
(
void
*
)
a
;
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -104,23 +91,22 @@ static int Open(vlc_object_t *object)
...
@@ -104,23 +91,22 @@ static int Open(vlc_object_t *object)
static
void
Close
(
vlc_object_t
*
object
)
static
void
Close
(
vlc_object_t
*
object
)
{
{
access_t
*
access
=
(
access_t
*
)
object
;
access_t
*
access
=
(
access_t
*
)
object
;
access_sys_t
*
sys
=
access
->
p_sys
;
input_attachment_t
*
a
=
(
void
*
)
access
->
p_sys
;
vlc_input_attachment_Delete
(
sys
->
a
);
vlc_input_attachment_Delete
(
a
);
free
(
sys
);
}
}
/* */
/* */
static
ssize_t
Read
(
access_t
*
access
,
uint8_t
*
buffer
,
size_t
size
)
static
ssize_t
Read
(
access_t
*
access
,
uint8_t
*
buffer
,
size_t
size
)
{
{
access_sys_t
*
sys
=
access
->
p_sys
;
input_attachment_t
*
a
=
(
void
*
)
access
->
p_sys
;
access
->
info
.
b_eof
=
access
->
info
.
i_pos
>=
(
uint64_t
)
sys
->
a
->
i_data
;
access
->
info
.
b_eof
=
access
->
info
.
i_pos
>=
(
uint64_t
)
a
->
i_data
;
if
(
access
->
info
.
b_eof
)
if
(
access
->
info
.
b_eof
)
return
0
;
return
0
;
const
size_t
copy
=
__MIN
(
size
,
sys
->
a
->
i_data
-
access
->
info
.
i_pos
);
const
size_t
copy
=
__MIN
(
size
,
a
->
i_data
-
access
->
info
.
i_pos
);
memcpy
(
buffer
,
(
uint8_t
*
)
sys
->
a
->
p_data
+
access
->
info
.
i_pos
,
copy
);
memcpy
(
buffer
,
(
uint8_t
*
)
a
->
p_data
+
access
->
info
.
i_pos
,
copy
);
access
->
info
.
i_pos
+=
copy
;
access
->
info
.
i_pos
+=
copy
;
return
copy
;
return
copy
;
}
}
...
...
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