Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
9f5c938f
Commit
9f5c938f
authored
Sep 09, 2011
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conf: add config_dup_block_path()
parent
b42a8d23
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
14 deletions
+38
-14
conf.c
src/conf.c
+20
-0
conf.h
src/conf.h
+9
-0
fifo_output_plugin.c
src/output/fifo_output_plugin.c
+9
-14
No files found.
src/conf.c
View file @
9f5c938f
...
@@ -606,6 +606,26 @@ config_get_block_string(const struct config_param *param, const char *name,
...
@@ -606,6 +606,26 @@ config_get_block_string(const struct config_param *param, const char *name,
return
bp
->
value
;
return
bp
->
value
;
}
}
char
*
config_dup_block_path
(
const
struct
config_param
*
param
,
const
char
*
name
,
GError
**
error_r
)
{
assert
(
error_r
!=
NULL
);
assert
(
*
error_r
==
NULL
);
const
struct
block_param
*
bp
=
config_get_block_param
(
param
,
name
);
if
(
bp
==
NULL
)
return
NULL
;
char
*
path
=
parsePath
(
bp
->
value
,
error_r
);
if
(
G_UNLIKELY
(
path
==
NULL
))
g_prefix_error
(
error_r
,
"Invalid path in
\"
%s
\"
at line %i: "
,
name
,
bp
->
line
);
return
path
;
}
unsigned
unsigned
config_get_block_unsigned
(
const
struct
config_param
*
param
,
const
char
*
name
,
config_get_block_unsigned
(
const
struct
config_param
*
param
,
const
char
*
name
,
unsigned
default_value
)
unsigned
default_value
)
...
...
src/conf.h
View file @
9f5c938f
...
@@ -194,6 +194,15 @@ config_dup_block_string(const struct config_param *param, const char *name,
...
@@ -194,6 +194,15 @@ config_dup_block_string(const struct config_param *param, const char *name,
return
g_strdup
(
config_get_block_string
(
param
,
name
,
default_value
));
return
g_strdup
(
config_get_block_string
(
param
,
name
,
default_value
));
}
}
/**
* Same as config_dup_path(), but looks up the setting in the
* specified block.
*/
G_GNUC_MALLOC
char
*
config_dup_block_path
(
const
struct
config_param
*
param
,
const
char
*
name
,
GError
**
error_r
);
G_GNUC_PURE
G_GNUC_PURE
unsigned
unsigned
config_get_block_unsigned
(
const
struct
config_param
*
param
,
const
char
*
name
,
config_get_block_unsigned
(
const
struct
config_param
*
param
,
const
char
*
name
,
...
...
src/output/fifo_output_plugin.c
View file @
9f5c938f
...
@@ -178,30 +178,25 @@ fifo_open(struct fifo_data *fd, GError **error)
...
@@ -178,30 +178,25 @@ fifo_open(struct fifo_data *fd, GError **error)
static
void
*
static
void
*
fifo_output_init
(
G_GNUC_UNUSED
const
struct
audio_format
*
audio_format
,
fifo_output_init
(
G_GNUC_UNUSED
const
struct
audio_format
*
audio_format
,
const
struct
config_param
*
param
,
const
struct
config_param
*
param
,
GError
**
error
)
GError
**
error
_r
)
{
{
struct
fifo_data
*
fd
;
struct
fifo_data
*
fd
;
char
*
value
,
*
path
;
value
=
config_dup_block_string
(
param
,
"path"
,
NULL
);
if
(
value
==
NULL
)
{
g_set_error
(
error
,
fifo_output_quark
(),
errno
,
"No
\"
path
\"
parameter specified"
);
return
NULL
;
}
path
=
parsePath
(
value
,
error
)
;
GError
*
error
=
NULL
;
g_free
(
value
);
char
*
path
=
config_dup_block_path
(
param
,
"path"
,
&
error
);
if
(
!
path
)
{
if
(
!
path
)
{
g_prefix_error
(
error
,
"Invalid path in line %i: "
,
if
(
error
!=
NULL
)
param
->
line
);
g_propagate_error
(
error_r
,
error
);
else
g_set_error
(
error_r
,
fifo_output_quark
(),
0
,
"No
\"
path
\"
parameter specified"
);
return
NULL
;
return
NULL
;
}
}
fd
=
fifo_data_new
();
fd
=
fifo_data_new
();
fd
->
path
=
path
;
fd
->
path
=
path
;
if
(
!
fifo_open
(
fd
,
error
))
{
if
(
!
fifo_open
(
fd
,
error
_r
))
{
fifo_data_free
(
fd
);
fifo_data_free
(
fd
);
return
NULL
;
return
NULL
;
}
}
...
...
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