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
Hide 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()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
struct
access_sys_t
{
input_attachment_t
*
a
;
};
static
ssize_t
Read
(
access_t
*
,
uint8_t
*
,
size_t
);
static
int
Seek
(
access_t
*
,
uint64_t
);
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
)
{
access_t
*
access
=
(
access_t
*
)
object
;
access_sys_t
*
sys
;
input_thread_t
*
input
=
access
->
p_input
;
if
(
!
input
)
...
...
@@ -82,21 +77,13 @@ static int Open(vlc_object_t *object)
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
->
pf_read
=
Read
;
access
->
pf_block
=
NULL
;
access
->
pf_control
=
Control
;
access
->
pf_seek
=
Seek
;
access
->
p_sys
=
(
void
*
)
a
;
return
VLC_SUCCESS
;
}
...
...
@@ -104,23 +91,22 @@ static int Open(vlc_object_t *object)
static
void
Close
(
vlc_object_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
);
free
(
sys
);
vlc_input_attachment_Delete
(
a
);
}
/* */
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
)
return
0
;
const
size_t
copy
=
__MIN
(
size
,
sys
->
a
->
i_data
-
access
->
info
.
i_pos
);
memcpy
(
buffer
,
(
uint8_t
*
)
sys
->
a
->
p_data
+
access
->
info
.
i_pos
,
copy
);
const
size_t
copy
=
__MIN
(
size
,
a
->
i_data
-
access
->
info
.
i_pos
);
memcpy
(
buffer
,
(
uint8_t
*
)
a
->
p_data
+
access
->
info
.
i_pos
,
copy
);
access
->
info
.
i_pos
+=
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