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
2564f763
Commit
2564f763
authored
Jan 09, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ClientList: don't use GLib
Use std::list instead of GList.
parent
377a2b9e
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
20 deletions
+19
-20
ClientExpire.cxx
src/ClientExpire.cxx
+1
-3
ClientIdle.cxx
src/ClientIdle.cxx
+1
-2
ClientList.cxx
src/ClientList.cxx
+14
-8
ClientList.hxx
src/ClientList.hxx
+1
-3
MessageCommands.cxx
src/MessageCommands.cxx
+2
-4
No files found.
src/ClientExpire.cxx
View file @
2564f763
...
...
@@ -41,10 +41,8 @@ client_set_expired(Client *client)
}
static
void
client_check_expired_callback
(
gpointer
data
,
G_GNUC_UNUSED
gpointer
user_data
)
client_check_expired_callback
(
Client
*
client
,
G_GNUC_UNUSED
gpointer
user_data
)
{
Client
*
client
=
(
Client
*
)
data
;
if
(
client_is_expired
(
client
))
{
g_debug
(
"[%u] expired"
,
client
->
num
);
client_close
(
client
);
...
...
src/ClientIdle.cxx
View file @
2564f763
...
...
@@ -70,9 +70,8 @@ client_idle_add(Client *client, unsigned flags)
}
static
void
client_idle_callback
(
gpointer
data
,
gpointer
user_data
)
client_idle_callback
(
Client
*
client
,
gpointer
user_data
)
{
Client
*
client
=
(
Client
*
)
data
;
unsigned
flags
=
GPOINTER_TO_UINT
(
user_data
);
client_idle_add
(
client
,
flags
);
...
...
src/ClientList.cxx
View file @
2564f763
...
...
@@ -21,9 +21,12 @@
#include "ClientList.hxx"
#include "ClientInternal.hxx"
#include <list>
#include <algorithm>
#include <assert.h>
static
GList
*
clients
;
static
std
::
list
<
Client
*>
clients
;
static
unsigned
num_clients
;
bool
...
...
@@ -41,30 +44,33 @@ client_list_is_full(void)
Client
*
client_list_get_first
(
void
)
{
assert
(
clients
!=
NULL
);
assert
(
!
clients
.
empty
()
);
return
(
Client
*
)
clients
->
data
;
return
clients
.
front
()
;
}
void
client_list_add
(
Client
*
client
)
{
clients
=
g_list_prepend
(
clients
,
client
);
clients
.
push_front
(
client
);
++
num_clients
;
}
void
client_list_foreach
(
GFunc
func
,
gpointer
user_data
)
client_list_foreach
(
void
(
*
callback
)(
Client
*
client
,
void
*
ctx
),
void
*
ctx
)
{
g_list_foreach
(
clients
,
func
,
user_data
);
for
(
Client
*
client
:
clients
)
callback
(
client
,
ctx
);
}
void
client_list_remove
(
Client
*
client
)
{
assert
(
num_clients
>
0
);
assert
(
clients
!=
NULL
);
assert
(
!
clients
.
empty
()
);
clients
=
g_list_remove
(
clients
,
client
);
auto
i
=
std
::
find
(
clients
.
begin
(),
clients
.
end
(),
client
);
assert
(
i
!=
clients
.
end
());
clients
.
erase
(
i
);
--
num_clients
;
}
src/ClientList.hxx
View file @
2564f763
...
...
@@ -20,8 +20,6 @@
#ifndef MPD_CLIENT_LIST_HXX
#define MPD_CLIENT_LIST_HXX
#include <glib.h>
class
Client
;
bool
...
...
@@ -37,7 +35,7 @@ void
client_list_add
(
Client
*
client
);
void
client_list_foreach
(
GFunc
func
,
gpointer
user_data
);
client_list_foreach
(
void
(
*
callback
)(
Client
*
client
,
void
*
ctx
),
void
*
ctx
);
void
client_list_remove
(
Client
*
client
);
...
...
src/MessageCommands.cxx
View file @
2564f763
...
...
@@ -78,11 +78,10 @@ struct channels_context {
};
static
void
collect_channels
(
gpointer
data
,
gpointer
user_data
)
collect_channels
(
Client
*
client
,
gpointer
user_data
)
{
struct
channels_context
*
context
=
(
struct
channels_context
*
)
user_data
;
const
Client
*
client
=
(
const
Client
*
)
data
;
context
->
channels
.
insert
(
client
->
subscriptions
.
begin
(),
client
->
subscriptions
.
end
());
...
...
@@ -133,11 +132,10 @@ struct send_message_context {
};
static
void
send_message
(
gpointer
data
,
gpointer
user_data
)
send_message
(
Client
*
client
,
gpointer
user_data
)
{
struct
send_message_context
*
context
=
(
struct
send_message_context
*
)
user_data
;
Client
*
client
=
(
Client
*
)
data
;
if
(
client_push_message
(
client
,
context
->
msg
))
context
->
sent
=
true
;
...
...
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