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
e5ef2d8a
Commit
e5ef2d8a
authored
Oct 31, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
client: removed list_cache
The list cache aims to save memory allocations, and complicates the code a bit. We should rather use GLib slices later, which are easy to use.
parent
8f37f7c8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
33 deletions
+0
-33
client.c
src/client.c
+0
-33
No files found.
src/client.c
View file @
e5ef2d8a
...
...
@@ -56,14 +56,6 @@ static size_t client_max_command_list_size =
static
size_t
client_max_output_buffer_size
=
CLIENT_MAX_OUTPUT_BUFFER_SIZE_DEFAULT
;
/* maybe make conf option for this, or... 32 might be good enough */
static
long
int
client_list_cache_size
=
32
;
/* shared globally between all clients: */
static
struct
strnode
*
list_cache
;
static
struct
strnode
*
list_cache_head
;
static
struct
strnode
*
list_cache_tail
;
struct
client
{
struct
list_head
siblings
;
...
...
@@ -165,11 +157,6 @@ static void free_cmd_list(struct strnode *list)
while
(
tmp
)
{
struct
strnode
*
next
=
tmp
->
next
;
if
(
tmp
>=
list_cache_head
&&
tmp
<=
list_cache_tail
)
{
/* inside list_cache[] array */
tmp
->
data
=
NULL
;
tmp
->
next
=
NULL
;
}
else
free
(
tmp
);
tmp
=
next
;
}
...
...
@@ -190,25 +177,11 @@ static void cmd_list_clone(struct client *client)
static
void
new_cmd_list_ptr
(
struct
client
*
client
,
char
*
s
,
const
int
size
)
{
int
i
;
struct
strnode
*
new
;
if
(
!
client
->
cmd_list_dup
)
{
for
(
i
=
client_list_cache_size
-
1
;
i
>=
0
;
--
i
)
{
if
(
list_cache
[
i
].
data
)
continue
;
new
=
&
(
list_cache
[
i
]);
new
->
data
=
s
;
/* implied in free_cmd_list() and init: */
/* last->next->next = NULL; */
goto
out
;
}
}
/* allocate from the heap */
new
=
client
->
cmd_list_dup
?
new_strnode_dup
(
s
,
size
)
:
new_strnode
(
s
);
out:
if
(
client
->
cmd_list
)
{
client
->
cmd_list_tail
->
next
=
new
;
client
->
cmd_list_tail
=
new
;
...
...
@@ -609,10 +582,6 @@ void client_manager_init(void)
}
client_max_output_buffer_size
=
tmp
*
1024
;
}
list_cache
=
xcalloc
(
client_list_cache_size
,
sizeof
(
struct
strnode
));
list_cache_head
=
&
(
list_cache
[
0
]);
list_cache_tail
=
&
(
list_cache
[
client_list_cache_size
-
1
]);
}
static
void
client_close_all
(
void
)
...
...
@@ -622,8 +591,6 @@ static void client_close_all(void)
list_for_each_entry_safe
(
client
,
n
,
&
clients
,
siblings
)
client_close
(
client
);
num_clients
=
0
;
free
(
list_cache
);
}
void
client_manager_deinit
(
void
)
...
...
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