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
1b8b05c7
Commit
1b8b05c7
authored
Aug 24, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config: simplify a bit
parent
1637adb2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
29 deletions
+15
-29
src/config/core.c
src/config/core.c
+4
-8
src/modules/entry.c
src/modules/entry.c
+11
-21
No files found.
src/config/core.c
View file @
1b8b05c7
...
...
@@ -356,10 +356,8 @@ ssize_t config_GetIntChoices (vlc_object_t *obj, const char *name,
if
(
count
==
0
)
return
0
;
int64_t
*
vals
=
malloc
(
sizeof
(
*
vals
)
*
count
);
char
**
txts
=
malloc
(
sizeof
(
*
txts
)
*
count
);
if
(
unlikely
(
vals
==
NULL
||
txts
==
NULL
))
abort
();
int64_t
*
vals
=
xmalloc
(
sizeof
(
*
vals
)
*
count
);
char
**
txts
=
xmalloc
(
sizeof
(
*
txts
)
*
count
);
for
(
size_t
i
=
0
;
i
<
count
;
i
++
)
{
...
...
@@ -406,10 +404,8 @@ ssize_t config_GetPszChoices (vlc_object_t *obj, const char *name,
return
cfg
->
list
.
psz_cb
(
obj
,
name
,
values
,
texts
);
}
char
**
vals
=
malloc
(
sizeof
(
*
vals
)
*
count
);
char
**
txts
=
malloc
(
sizeof
(
*
txts
)
*
count
);
if
(
unlikely
(
vals
==
NULL
||
txts
==
NULL
))
abort
();
char
**
vals
=
xmalloc
(
sizeof
(
*
vals
)
*
count
);
char
**
txts
=
xmalloc
(
sizeof
(
*
txts
)
*
count
);
for
(
size_t
i
=
0
;
i
<
count
;
i
++
)
{
...
...
src/modules/entry.c
View file @
1b8b05c7
...
...
@@ -379,31 +379,25 @@ static int vlc_plugin_setter (void *plugin, void *tgt, int propid, ...)
assert
(
item
->
list_count
==
0
);
/* cannot replace choices */
assert
(
item
->
list
.
psz_cb
==
NULL
);
if
(
len
==
0
)
break
;
/* nothing to do */
/* Copy values */
if
(
IsConfigIntegerType
(
item
->
i_type
))
{
const
int
*
src
=
va_arg
(
ap
,
const
int
*
);
int
*
dst
=
malloc
(
sizeof
(
int
)
*
(
len
+
1
)
);
int
*
dst
=
xmalloc
(
sizeof
(
int
)
*
len
);
if
(
dst
!=
NULL
)
{
memcpy
(
dst
,
src
,
sizeof
(
int
)
*
len
);
dst
[
len
]
=
0
;
}
memcpy
(
dst
,
src
,
sizeof
(
int
)
*
len
);
item
->
list
.
i
=
dst
;
}
else
if
(
IsConfigStringType
(
item
->
i_type
))
{
const
char
*
const
*
src
=
va_arg
(
ap
,
const
char
*
const
*
);
char
**
dst
=
malloc
(
sizeof
(
char
*
)
*
(
len
+
1
));
if
(
dst
!=
NULL
)
{
for
(
size_t
i
=
0
;
i
<
len
;
i
++
)
dst
[
i
]
=
src
[
i
]
?
strdup
(
src
[
i
])
:
NULL
;
dst
[
len
]
=
NULL
;
}
char
**
dst
=
xmalloc
(
sizeof
(
char
*
)
*
len
);
for
(
size_t
i
=
0
;
i
<
len
;
i
++
)
dst
[
i
]
=
src
[
i
]
?
strdup
(
src
[
i
])
:
NULL
;
item
->
list
.
psz
=
dst
;
}
else
...
...
@@ -411,13 +405,9 @@ static int vlc_plugin_setter (void *plugin, void *tgt, int propid, ...)
/* Copy textual descriptions */
const
char
*
const
*
text
=
va_arg
(
ap
,
const
char
*
const
*
);
char
**
dtext
=
malloc
(
sizeof
(
char
*
)
*
(
len
+
1
));
if
(
dtext
!=
NULL
)
{
for
(
size_t
i
=
0
;
i
<
len
;
i
++
)
dtext
[
i
]
=
text
[
i
]
?
strdup
(
text
[
i
])
:
NULL
;
dtext
[
len
]
=
NULL
;
}
char
**
dtext
=
xmalloc
(
sizeof
(
char
*
)
*
(
len
+
1
));
for
(
size_t
i
=
0
;
i
<
len
;
i
++
)
dtext
[
i
]
=
text
[
i
]
?
strdup
(
text
[
i
])
:
NULL
;
item
->
list_text
=
dtext
;
item
->
list_count
=
len
;
break
;
...
...
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