Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libnice
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
libnice
Commits
1513ce23
Commit
1513ce23
authored
Feb 08, 2016
by
Olivier Crête
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace g_malloc/g_new with g_alloca where possible
This should reduce the overhead a bit.
parent
524c1090
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
10 deletions
+4
-10
agent/agent.c
agent/agent.c
+2
-4
socket/udp-turn-over-tcp.c
socket/udp-turn-over-tcp.c
+1
-3
socket/udp-turn.c
socket/udp-turn.c
+1
-3
No files found.
agent/agent.c
View file @
1513ce23
...
...
@@ -3419,7 +3419,7 @@ agent_recv_message_unlocked (
n_bufs
=
message
->
n_buffers
;
}
local_bufs
=
g_
malloc_n
(
n_bufs
+
1
,
sizeof
(
GInputVector
));
local_bufs
=
g_
alloca
((
n_bufs
+
1
)
*
sizeof
(
GInputVector
));
local_message
.
buffers
=
local_bufs
;
local_message
.
n_buffers
=
n_bufs
+
1
;
local_message
.
from
=
message
->
from
;
...
...
@@ -3436,7 +3436,6 @@ agent_recv_message_unlocked (
if
(
retval
==
1
)
{
message
->
length
=
ntohs
(
rfc4571_frame
);
}
g_free
(
local_bufs
);
}
else
{
if
(
nicesock
->
type
==
NICE_SOCKET_TYPE_TCP_PASSIVE
)
{
NiceSocket
*
new_socket
;
...
...
@@ -3517,7 +3516,7 @@ agent_recv_message_unlocked (
n_bufs
=
message
->
n_buffers
;
}
local_bufs
=
g_
malloc_n
(
n_bufs
,
sizeof
(
GInputVector
));
local_bufs
=
g_
alloca
(
n_bufs
*
sizeof
(
GInputVector
));
local_message
.
buffers
=
local_bufs
;
local_message
.
from
=
message
->
from
;
local_message
.
length
=
0
;
...
...
@@ -3544,7 +3543,6 @@ agent_recv_message_unlocked (
message
->
length
=
local_message
.
length
;
agent
->
rfc4571_expecting_length
-=
local_message
.
length
;
}
g_free
(
local_bufs
);
}
}
}
...
...
socket/udp-turn-over-tcp.c
View file @
1513ce23
...
...
@@ -303,7 +303,7 @@ socket_send_message (NiceSocket *sock, const NiceAddress *to,
/* Allocate a new array of buffers, covering all the buffers in the input
* @message, but with an additional one for a header and one for a footer. */
local_bufs
=
g_
malloc_n
(
n_bufs
+
1
,
sizeof
(
GOutputVector
));
local_bufs
=
g_
alloca
((
n_bufs
+
1
)
*
sizeof
(
GOutputVector
));
local_message
.
buffers
=
local_bufs
;
local_message
.
n_buffers
=
n_bufs
+
1
;
...
...
@@ -379,8 +379,6 @@ socket_send_message (NiceSocket *sock, const NiceAddress *to,
if
(
ret
==
1
)
ret
=
output_message_get_size
(
&
local_message
);
g_free
(
local_bufs
);
return
ret
;
}
...
...
socket/udp-turn.c
View file @
1513ce23
...
...
@@ -584,7 +584,7 @@ _socket_send_messages_wrapped (NiceSocket *sock, const NiceAddress *to,
n_bufs
=
message
->
n_buffers
;
}
local_bufs
=
g_
malloc_n
(
n_bufs
+
1
,
sizeof
(
GOutputVector
));
local_bufs
=
g_
alloca
((
n_bufs
+
1
)
*
sizeof
(
GOutputVector
));
local_message
.
buffers
=
local_bufs
;
local_message
.
n_buffers
=
n_bufs
+
1
;
...
...
@@ -607,8 +607,6 @@ _socket_send_messages_wrapped (NiceSocket *sock, const NiceAddress *to,
if
(
ret
==
1
)
ret
=
message_len
;
g_free
(
local_bufs
);
return
ret
;
}
}
...
...
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