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
aa772ebc
Commit
aa772ebc
authored
Nov 01, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tag: use GLib instead of utils.h
Don't use the deprecated functions from utils.h.
parent
35710a81
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
tag.c
src/tag.c
+10
-8
No files found.
src/tag.c
View file @
aa772ebc
...
@@ -26,6 +26,8 @@
...
@@ -26,6 +26,8 @@
#include <glib.h>
#include <glib.h>
#include <assert.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
/**
/**
* Maximum number of items managed in the bulk list; if it is
* Maximum number of items managed in the bulk list; if it is
...
@@ -85,7 +87,7 @@ void tag_lib_init(void)
...
@@ -85,7 +87,7 @@ void tag_lib_init(void)
if
(
0
==
strcasecmp
(
param
->
value
,
"none"
))
if
(
0
==
strcasecmp
(
param
->
value
,
"none"
))
return
;
return
;
temp
=
c
=
s
=
x
strdup
(
param
->
value
);
temp
=
c
=
s
=
g_
strdup
(
param
->
value
);
while
(
!
quit
)
{
while
(
!
quit
)
{
if
(
*
s
==
','
||
*
s
==
'\0'
)
{
if
(
*
s
==
','
||
*
s
==
'\0'
)
{
if
(
*
s
==
'\0'
)
if
(
*
s
==
'\0'
)
...
@@ -180,7 +182,7 @@ struct tag *tag_ape_load(const char *file)
...
@@ -180,7 +182,7 @@ struct tag *tag_ape_load(const char *file)
tagLen
-=
sizeof
(
footer
);
tagLen
-=
sizeof
(
footer
);
if
(
tagLen
<=
0
)
if
(
tagLen
<=
0
)
goto
fail
;
goto
fail
;
buffer
=
x
malloc
(
tagLen
);
buffer
=
g_
malloc
(
tagLen
);
if
(
fread
(
buffer
,
1
,
tagLen
,
fp
)
!=
tagLen
)
if
(
fread
(
buffer
,
1
,
tagLen
,
fp
)
!=
tagLen
)
goto
fail
;
goto
fail
;
...
@@ -233,7 +235,7 @@ fail:
...
@@ -233,7 +235,7 @@ fail:
struct
tag
*
tag_new
(
void
)
struct
tag
*
tag_new
(
void
)
{
{
struct
tag
*
ret
=
xmalloc
(
sizeof
(
*
ret
)
);
struct
tag
*
ret
=
g_new
(
struct
tag
,
1
);
ret
->
items
=
NULL
;
ret
->
items
=
NULL
;
ret
->
time
=
-
1
;
ret
->
time
=
-
1
;
ret
->
numOfItems
=
0
;
ret
->
numOfItems
=
0
;
...
@@ -255,7 +257,7 @@ static void deleteItem(struct tag *tag, int idx)
...
@@ -255,7 +257,7 @@ static void deleteItem(struct tag *tag, int idx)
}
}
if
(
tag
->
numOfItems
>
0
)
{
if
(
tag
->
numOfItems
>
0
)
{
tag
->
items
=
x
realloc
(
tag
->
items
,
items_size
(
tag
));
tag
->
items
=
g_
realloc
(
tag
->
items
,
items_size
(
tag
));
}
else
{
}
else
{
free
(
tag
->
items
);
free
(
tag
->
items
);
tag
->
items
=
NULL
;
tag
->
items
=
NULL
;
...
@@ -307,7 +309,7 @@ struct tag *tag_dup(const struct tag *tag)
...
@@ -307,7 +309,7 @@ struct tag *tag_dup(const struct tag *tag)
ret
=
tag_new
();
ret
=
tag_new
();
ret
->
time
=
tag
->
time
;
ret
->
time
=
tag
->
time
;
ret
->
numOfItems
=
tag
->
numOfItems
;
ret
->
numOfItems
=
tag
->
numOfItems
;
ret
->
items
=
ret
->
numOfItems
>
0
?
x
malloc
(
items_size
(
tag
))
:
NULL
;
ret
->
items
=
ret
->
numOfItems
>
0
?
g_
malloc
(
items_size
(
tag
))
:
NULL
;
pthread_mutex_lock
(
&
tag_pool_lock
);
pthread_mutex_lock
(
&
tag_pool_lock
);
for
(
i
=
0
;
i
<
tag
->
numOfItems
;
i
++
)
for
(
i
=
0
;
i
<
tag
->
numOfItems
;
i
++
)
...
@@ -388,7 +390,7 @@ void tag_end_add(struct tag *tag)
...
@@ -388,7 +390,7 @@ void tag_end_add(struct tag *tag)
if
(
tag
->
numOfItems
>
0
)
{
if
(
tag
->
numOfItems
>
0
)
{
/* copy the tag items from the bulk list over
/* copy the tag items from the bulk list over
to a new list (which fits exactly) */
to a new list (which fits exactly) */
tag
->
items
=
x
malloc
(
items_size
(
tag
));
tag
->
items
=
g_
malloc
(
items_size
(
tag
));
memcpy
(
tag
->
items
,
bulk
.
items
,
items_size
(
tag
));
memcpy
(
tag
->
items
,
bulk
.
items
,
items_size
(
tag
));
}
else
}
else
tag
->
items
=
NULL
;
tag
->
items
=
NULL
;
...
@@ -420,12 +422,12 @@ static void appendToTagItems(struct tag *tag, enum tag_type type,
...
@@ -420,12 +422,12 @@ static void appendToTagItems(struct tag *tag, enum tag_type type,
if
(
tag
->
items
!=
bulk
.
items
)
if
(
tag
->
items
!=
bulk
.
items
)
/* bulk mode disabled */
/* bulk mode disabled */
tag
->
items
=
x
realloc
(
tag
->
items
,
items_size
(
tag
));
tag
->
items
=
g_
realloc
(
tag
->
items
,
items_size
(
tag
));
else
if
(
tag
->
numOfItems
>=
BULK_MAX
)
{
else
if
(
tag
->
numOfItems
>=
BULK_MAX
)
{
/* bulk list already full - switch back to non-bulk */
/* bulk list already full - switch back to non-bulk */
assert
(
bulk
.
busy
);
assert
(
bulk
.
busy
);
tag
->
items
=
x
malloc
(
items_size
(
tag
));
tag
->
items
=
g_
malloc
(
items_size
(
tag
));
memcpy
(
tag
->
items
,
bulk
.
items
,
memcpy
(
tag
->
items
,
bulk
.
items
,
items_size
(
tag
)
-
sizeof
(
struct
tag_item
*
));
items_size
(
tag
)
-
sizeof
(
struct
tag_item
*
));
}
}
...
...
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