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
4ab586aa
Commit
4ab586aa
authored
Dec 03, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tag: use new[]/delete[] instead of g_new()/g_free()
parent
8a5209ad
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
11 deletions
+4
-11
Tag.cxx
src/tag/Tag.cxx
+3
-10
TagBuilder.cxx
src/tag/TagBuilder.cxx
+1
-1
No files found.
src/tag/Tag.cxx
View file @
4ab586aa
...
...
@@ -25,7 +25,6 @@
#include "TagBuilder.hxx"
#include "util/ASCII.hxx"
#include <glib.h>
#include <assert.h>
#include <string.h>
...
...
@@ -59,12 +58,6 @@ tag_name_parse_i(const char *name)
return
TAG_NUM_OF_ITEM_TYPES
;
}
static
size_t
items_size
(
const
Tag
&
tag
)
{
return
tag
.
num_items
*
sizeof
(
TagItem
*
);
}
void
Tag
::
Clear
()
{
...
...
@@ -76,7 +69,7 @@ Tag::Clear()
tag_pool_put_item
(
items
[
i
]);
tag_pool_lock
.
unlock
();
g_free
(
items
)
;
delete
[]
items
;
items
=
nullptr
;
num_items
=
0
;
}
...
...
@@ -88,7 +81,7 @@ Tag::~Tag()
tag_pool_put_item
(
items
[
i
]);
tag_pool_lock
.
unlock
();
g_free
(
items
)
;
delete
[]
items
;
}
Tag
::
Tag
(
const
Tag
&
other
)
...
...
@@ -97,7 +90,7 @@ Tag::Tag(const Tag &other)
num_items
(
other
.
num_items
)
{
if
(
num_items
>
0
)
{
items
=
(
TagItem
**
)
g_malloc
(
items_size
(
other
))
;
items
=
new
TagItem
*
[
num_items
]
;
tag_pool_lock
.
lock
();
for
(
unsigned
i
=
0
;
i
<
num_items
;
i
++
)
...
...
src/tag/TagBuilder.cxx
View file @
4ab586aa
...
...
@@ -125,7 +125,7 @@ TagBuilder::Commit(Tag &tag)
object */
const
unsigned
n_items
=
items
.
size
();
tag
.
num_items
=
n_items
;
tag
.
items
=
g_new
(
TagItem
*
,
n_items
)
;
tag
.
items
=
new
TagItem
*
[
n_items
]
;
std
::
copy_n
(
items
.
begin
(),
n_items
,
tag
.
items
);
items
.
clear
();
...
...
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