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
34e9a0a9
Commit
34e9a0a9
authored
Jun 19, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conf: replace "mask" bit field with two "bool" variables
Due to padding, this takes the same amount of memory.
parent
b1e95b1f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
12 deletions
+6
-12
conf.c
src/conf.c
+6
-12
No files found.
src/conf.c
View file @
34e9a0a9
...
...
@@ -39,13 +39,12 @@
#define CONF_BLOCK_BEGIN "{"
#define CONF_BLOCK_END "}"
#define CONF_REPEATABLE_MASK 0x01
#define CONF_BLOCK_MASK 0x02
#define CONF_LINE_TOKEN_MAX 3
struct
config_entry
{
const
char
*
name
;
unsigned
char
mask
;
bool
repeatable
;
bool
block
;
GSList
*
params
;
};
...
...
@@ -111,14 +110,10 @@ newConfigEntry(const char *name, int repeatable, int block)
struct
config_entry
*
ret
=
g_new
(
struct
config_entry
,
1
);
ret
->
name
=
name
;
ret
->
mask
=
0
;
ret
->
repeatable
=
repeatable
;
ret
->
block
=
block
;
ret
->
params
=
NULL
;
if
(
repeatable
)
ret
->
mask
|=
CONF_REPEATABLE_MASK
;
if
(
block
)
ret
->
mask
|=
CONF_BLOCK_MASK
;
return
ret
;
}
...
...
@@ -334,15 +329,14 @@ void config_read_file(const char *file)
g_error
(
"unrecognized parameter in config file at "
"line %i: %s
\n
"
,
count
,
string
);
if
(
!
(
entry
->
mask
&
CONF_REPEATABLE_MASK
)
&&
entry
->
params
!=
NULL
)
{
if
(
entry
->
params
!=
NULL
&&
!
entry
->
repeatable
)
{
param
=
entry
->
params
->
data
;
g_error
(
"config parameter
\"
%s
\"
is first defined on "
"line %i and redefined on line %i
\n
"
,
array
[
0
],
param
->
line
,
count
);
}
if
(
entry
->
mask
&
CONF_BLOCK_MASK
)
{
if
(
entry
->
block
)
{
if
(
0
!=
strcmp
(
array
[
1
],
CONF_BLOCK_BEGIN
))
{
g_error
(
"improperly formatted config file at "
"line %i: %s
\n
"
,
count
,
string
);
...
...
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