Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
2f601f63
Commit
2f601f63
authored
May 05, 2008
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not leak 1 byte per variable created
parent
0451476b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
src/misc/variables.c
src/misc/variables.c
+9
-3
No files found.
src/misc/variables.c
View file @
2f601f63
...
...
@@ -53,7 +53,13 @@ static int CmpTime( vlc_value_t v, vlc_value_t w )
{
return
v
.
i_time
==
w
.
i_time
?
0
:
v
.
i_time
>
w
.
i_time
?
1
:
-
1
;
}
static
int
CmpString
(
vlc_value_t
v
,
vlc_value_t
w
)
{
return
strcmp
(
v
.
psz_string
,
w
.
psz_string
);
}
static
int
CmpString
(
vlc_value_t
v
,
vlc_value_t
w
)
{
if
(
!
v
.
psz_string
)
return
!
w
.
psz_string
?
0
:
-
1
;
else
return
!
w
.
psz_string
?
1
:
strcmp
(
v
.
psz_string
,
w
.
psz_string
);
}
static
int
CmpFloat
(
vlc_value_t
v
,
vlc_value_t
w
)
{
return
v
.
f_float
==
w
.
f_float
?
0
:
v
.
f_float
>
w
.
f_float
?
1
:
-
1
;
}
static
int
CmpAddress
(
vlc_value_t
v
,
vlc_value_t
w
)
{
return
v
.
p_address
==
w
.
p_address
?
0
:
v
.
p_address
>
w
.
p_address
?
1
:
-
1
;
}
...
...
@@ -61,7 +67,7 @@ static int CmpAddress( vlc_value_t v, vlc_value_t w ) { return v.p_address == w.
* Local duplication functions, and local deallocation functions
*****************************************************************************/
static
void
DupDummy
(
vlc_value_t
*
p_val
)
{
(
void
)
p_val
;
/* unused */
}
static
void
DupString
(
vlc_value_t
*
p_val
)
{
p_val
->
psz_string
=
strdup
(
p_val
->
psz_string
);
}
static
void
DupString
(
vlc_value_t
*
p_val
)
{
if
(
p_val
->
psz_string
)
p_val
->
psz_string
=
strdup
(
p_val
->
psz_string
);
}
static
void
DupList
(
vlc_value_t
*
p_val
)
{
...
...
@@ -247,7 +253,7 @@ int __var_Create( vlc_object_t *p_this, const char *psz_name, int i_type )
p_var
->
pf_cmp
=
CmpString
;
p_var
->
pf_dup
=
DupString
;
p_var
->
pf_free
=
FreeString
;
p_var
->
val
.
psz_string
=
strdup
(
""
)
;
p_var
->
val
.
psz_string
=
NULL
;
break
;
case
VLC_VAR_FLOAT
:
p_var
->
pf_cmp
=
CmpFloat
;
...
...
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