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
635ec3ce
Commit
635ec3ce
authored
Oct 13, 2021
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util/VarSize: use plain malloc()
parent
8e71130e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
VarSize.hxx
src/util/VarSize.hxx
+3
-2
No files found.
src/util/VarSize.hxx
View file @
635ec3ce
...
...
@@ -30,7 +30,6 @@
#ifndef MPD_VAR_SIZE_HXX
#define MPD_VAR_SIZE_HXX
#include "Alloc.hxx"
#include "Compiler.h"
#include <type_traits>
...
...
@@ -61,7 +60,9 @@ NewVarSize(size_t declared_tail_size, size_t real_tail_size, Args&&... args)
size_t
size
=
sizeof
(
T
)
-
declared_tail_size
+
real_tail_size
;
/* allocate memory */
T
*
instance
=
(
T
*
)
xalloc
(
size
);
T
*
instance
=
(
T
*
)
malloc
(
size
);
if
(
instance
==
nullptr
)
throw
std
::
bad_alloc
{};
/* call the constructor */
new
(
instance
)
T
(
std
::
forward
<
Args
>
(
args
)...);
...
...
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