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
5b543e8f
Commit
5b543e8f
authored
Jan 03, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
permission: use g_strsplit() instead of strtok_r()
g_strsplit() is more portable than strtok_r().
parent
6507bccc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
permission.c
src/permission.c
+9
-8
No files found.
src/permission.c
View file @
5b543e8f
...
@@ -38,17 +38,18 @@ static GHashTable *permission_passwords;
...
@@ -38,17 +38,18 @@ static GHashTable *permission_passwords;
static
unsigned
permission_default
;
static
unsigned
permission_default
;
static
unsigned
parsePermissions
(
char
*
string
)
static
unsigned
parsePermissions
(
c
onst
c
har
*
string
)
{
{
unsigned
permission
=
0
;
unsigned
permission
=
0
;
char
*
temp
;
gchar
**
tokens
;
char
*
tok
;
if
(
!
string
)
if
(
!
string
)
return
0
;
return
0
;
temp
=
strtok_r
(
string
,
PERMISSION_SEPERATOR
,
&
tok
);
tokens
=
g_strsplit
(
string
,
PERMISSION_SEPERATOR
,
0
);
while
(
temp
)
{
for
(
unsigned
i
=
0
;
tokens
[
i
]
!=
NULL
;
++
i
)
{
char
*
temp
=
tokens
[
i
];
if
(
strcmp
(
temp
,
PERMISSION_READ_STRING
)
==
0
)
{
if
(
strcmp
(
temp
,
PERMISSION_READ_STRING
)
==
0
)
{
permission
|=
PERMISSION_READ
;
permission
|=
PERMISSION_READ
;
}
else
if
(
strcmp
(
temp
,
PERMISSION_ADD_STRING
)
==
0
)
{
}
else
if
(
strcmp
(
temp
,
PERMISSION_ADD_STRING
)
==
0
)
{
...
@@ -60,10 +61,10 @@ static unsigned parsePermissions(char *string)
...
@@ -60,10 +61,10 @@ static unsigned parsePermissions(char *string)
}
else
{
}
else
{
FATAL
(
"unknown permission
\"
%s
\"\n
"
,
temp
);
FATAL
(
"unknown permission
\"
%s
\"\n
"
,
temp
);
}
}
temp
=
strtok_r
(
NULL
,
PERMISSION_SEPERATOR
,
&
tok
);
}
}
g_strfreev
(
tokens
);
return
permission
;
return
permission
;
}
}
...
@@ -85,7 +86,7 @@ void initPermissions(void)
...
@@ -85,7 +86,7 @@ void initPermissions(void)
permission_default
=
0
;
permission_default
=
0
;
do
{
do
{
char
*
separator
=
c
onst
c
har
*
separator
=
strchr
(
param
->
value
,
PERMISSION_PASSWORD_CHAR
);
strchr
(
param
->
value
,
PERMISSION_PASSWORD_CHAR
);
if
(
separator
==
NULL
)
if
(
separator
==
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