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
a899c210
Commit
a899c210
authored
Mar 15, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
log: removed DEBUG() and FATAL()
Use GLib the logging functions g_debug(), g_error() instead.
parent
9e30dfb9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
22 additions
and
49 deletions
+22
-49
command.c
src/command.c
+3
-4
decoder_thread.c
src/decoder_thread.c
+1
-2
log.c
src/log.c
+0
-24
log.h
src/log.h
+0
-3
main.c
src/main.c
+3
-3
permission.c
src/permission.c
+5
-6
sig_handlers.c
src/sig_handlers.c
+1
-1
song_save.c
src/song_save.c
+7
-3
tag.c
src/tag.c
+2
-3
No files found.
src/command.c
View file @
a899c210
...
@@ -33,7 +33,6 @@
...
@@ -33,7 +33,6 @@
#include "stats.h"
#include "stats.h"
#include "permission.h"
#include "permission.h"
#include "buffer2array.h"
#include "buffer2array.h"
#include "log.h"
#include "stored_playlist.h"
#include "stored_playlist.h"
#include "ack.h"
#include "ack.h"
#include "output_command.h"
#include "output_command.h"
...
@@ -1797,10 +1796,10 @@ command_process_list(struct client *client,
...
@@ -1797,10 +1796,10 @@ command_process_list(struct client *client,
for
(
GSList
*
cur
=
list
;
cur
!=
NULL
;
cur
=
g_slist_next
(
cur
))
{
for
(
GSList
*
cur
=
list
;
cur
!=
NULL
;
cur
=
g_slist_next
(
cur
))
{
char
*
cmd
=
cur
->
data
;
char
*
cmd
=
cur
->
data
;
DEBUG
(
"command_process_list: process command
\"
%s
\"\n
"
,
g_debug
(
"command_process_list: process command
\"
%s
\"
"
,
cmd
);
cmd
);
ret
=
command_process
(
client
,
cmd
);
ret
=
command_process
(
client
,
cmd
);
DEBUG
(
"command_process_list: command returned %i
\n
"
,
ret
);
g_debug
(
"command_process_list: command returned %i
"
,
ret
);
if
(
ret
!=
COMMAND_RETURN_OK
||
client_is_expired
(
client
))
if
(
ret
!=
COMMAND_RETURN_OK
||
client_is_expired
(
client
))
break
;
break
;
else
if
(
list_ok
)
else
if
(
list_ok
)
...
...
src/decoder_thread.c
View file @
a899c210
...
@@ -29,7 +29,6 @@
...
@@ -29,7 +29,6 @@
#include "tag.h"
#include "tag.h"
#include "mapper.h"
#include "mapper.h"
#include "path.h"
#include "path.h"
#include "log.h"
#include "uri.h"
#include "uri.h"
#include <glib.h>
#include <glib.h>
...
@@ -269,5 +268,5 @@ void decoder_thread_start(void)
...
@@ -269,5 +268,5 @@ void decoder_thread_start(void)
dc
.
thread
=
g_thread_create
(
decoder_task
,
NULL
,
true
,
&
e
);
dc
.
thread
=
g_thread_create
(
decoder_task
,
NULL
,
true
,
&
e
);
if
(
dc
.
thread
==
NULL
)
if
(
dc
.
thread
==
NULL
)
FATAL
(
"Failed to spawn decoder task: %s
\n
"
,
e
->
message
);
g_error
(
"Failed to spawn decoder task: %s
"
,
e
->
message
);
}
}
src/log.c
View file @
a899c210
...
@@ -285,30 +285,6 @@ void setup_log_output(bool use_stdout)
...
@@ -285,30 +285,6 @@ void setup_log_output(bool use_stdout)
}
}
}
}
#define log_func(func,level) \
G_GNUC_PRINTF(1, 2) void func(const char *fmt, ...) \
{ \
if (level <= log_threshold) { \
va_list args; \
va_start(args, fmt); \
g_logv(NULL, level, fmt, args); \
va_end(args); \
} \
}
log_func
(
DEBUG
,
G_LOG_LEVEL_DEBUG
)
#undef log_func
G_GNUC_PRINTF
(
1
,
2
)
G_GNUC_NORETURN
void
FATAL
(
const
char
*
fmt
,
...)
{
va_list
args
;
va_start
(
args
,
fmt
);
g_logv
(
NULL
,
G_LOG_LEVEL_ERROR
,
fmt
,
args
);
va_end
(
args
);
exit
(
EXIT_FAILURE
);
}
int
cycle_log_files
(
void
)
int
cycle_log_files
(
void
)
{
{
int
fd
;
int
fd
;
...
...
src/log.h
View file @
a899c210
...
@@ -23,9 +23,6 @@
...
@@ -23,9 +23,6 @@
#include <glib.h>
#include <glib.h>
#include <stdbool.h>
#include <stdbool.h>
G_GNUC_PRINTF
(
1
,
2
)
void
DEBUG
(
const
char
*
fmt
,
...);
G_GNUC_PRINTF
(
1
,
2
)
G_GNUC_NORETURN
void
FATAL
(
const
char
*
fmt
,
...);
/**
/**
* Configure a logging destination for daemon startup, before the
* Configure a logging destination for daemon startup, before the
* configuration file is read. This allows the daemon to use the
* configuration file is read. This allows the daemon to use the
...
...
src/main.c
View file @
a899c210
...
@@ -168,9 +168,9 @@ initialize_decoder_and_player(void)
...
@@ -168,9 +168,9 @@ initialize_decoder_and_player(void)
if
(
param
!=
NULL
)
{
if
(
param
!=
NULL
)
{
perc
=
strtod
(
param
->
value
,
&
test
);
perc
=
strtod
(
param
->
value
,
&
test
);
if
(
*
test
!=
'%'
||
perc
<
0
||
perc
>
100
)
{
if
(
*
test
!=
'%'
||
perc
<
0
||
perc
>
100
)
{
FATAL
(
"buffered before play
\"
%s
\"
is not a positive "
g_error
(
"buffered before play
\"
%s
\"
is not a positive "
"percentage and less than 100 percent, line %i"
"percentage and less than 100 percent, line %i"
,
"
\n
"
,
param
->
value
,
param
->
line
);
param
->
value
,
param
->
line
);
}
}
}
else
}
else
perc
=
DEFAULT_BUFFER_BEFORE_PLAY
;
perc
=
DEFAULT_BUFFER_BEFORE_PLAY
;
...
...
src/permission.c
View file @
a899c210
...
@@ -19,7 +19,6 @@
...
@@ -19,7 +19,6 @@
#include "permission.h"
#include "permission.h"
#include "conf.h"
#include "conf.h"
#include "log.h"
#include <glib.h>
#include <glib.h>
...
@@ -59,7 +58,7 @@ static unsigned parsePermissions(const char *string)
...
@@ -59,7 +58,7 @@ static unsigned parsePermissions(const char *string)
}
else
if
(
strcmp
(
temp
,
PERMISSION_ADMIN_STRING
)
==
0
)
{
}
else
if
(
strcmp
(
temp
,
PERMISSION_ADMIN_STRING
)
==
0
)
{
permission
|=
PERMISSION_ADMIN
;
permission
|=
PERMISSION_ADMIN
;
}
else
{
}
else
{
FATAL
(
"unknown permission
\"
%s
\"\n
"
,
temp
);
g_error
(
"unknown permission
\"
%s
\"
"
,
temp
);
}
}
}
}
...
@@ -90,10 +89,10 @@ void initPermissions(void)
...
@@ -90,10 +89,10 @@ void initPermissions(void)
strchr
(
param
->
value
,
PERMISSION_PASSWORD_CHAR
);
strchr
(
param
->
value
,
PERMISSION_PASSWORD_CHAR
);
if
(
separator
==
NULL
)
if
(
separator
==
NULL
)
FATAL
(
"
\"
%c
\"
not found in password string "
g_error
(
"
\"
%c
\"
not found in password string "
"
\"
%s
\"
, line %i
\n
"
,
"
\"
%s
\"
, line %i
"
,
PERMISSION_PASSWORD_CHAR
,
PERMISSION_PASSWORD_CHAR
,
param
->
value
,
param
->
line
);
param
->
value
,
param
->
line
);
password
=
g_strndup
(
param
->
value
,
password
=
g_strndup
(
param
->
value
,
separator
-
param
->
value
);
separator
-
param
->
value
);
...
...
src/sig_handlers.c
View file @
a899c210
...
@@ -51,7 +51,7 @@ x_sigaction(int signum, const struct sigaction *act)
...
@@ -51,7 +51,7 @@ x_sigaction(int signum, const struct sigaction *act)
static
void
static
void
handle_reload_event
(
void
)
handle_reload_event
(
void
)
{
{
DEBUG
(
"got SIGHUP, rereading DB
\n
"
);
g_debug
(
"got SIGHUP, reopening log files
"
);
cycle_log_files
();
cycle_log_files
();
}
}
...
...
src/song_save.c
View file @
a899c210
...
@@ -23,10 +23,14 @@
...
@@ -23,10 +23,14 @@
#include "directory.h"
#include "directory.h"
#include "path.h"
#include "path.h"
#include "tag.h"
#include "tag.h"
#include "log.h"
#include <glib.h>
#include <stdlib.h>
#include <stdlib.h>
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "song"
#define SONG_KEY "key: "
#define SONG_KEY "key: "
#define SONG_MTIME "mtime: "
#define SONG_MTIME "mtime: "
...
@@ -126,7 +130,7 @@ void readSongInfoIntoList(FILE *fp, struct songvec *sv,
...
@@ -126,7 +130,7 @@ void readSongInfoIntoList(FILE *fp, struct songvec *sv,
}
else
if
(
*
buffer
==
0
)
{
}
else
if
(
*
buffer
==
0
)
{
/* ignore empty lines (starting with '\0') */
/* ignore empty lines (starting with '\0') */
}
else
if
(
song
==
NULL
)
{
}
else
if
(
song
==
NULL
)
{
FATAL
(
"Problems reading song info
\n
"
);
g_error
(
"Problems reading song info
"
);
}
else
if
(
0
==
strncmp
(
SONG_FILE
,
buffer
,
strlen
(
SONG_FILE
)))
{
}
else
if
(
0
==
strncmp
(
SONG_FILE
,
buffer
,
strlen
(
SONG_FILE
)))
{
/* we don't need this info anymore */
/* we don't need this info anymore */
}
else
if
((
value
=
matchesAnMpdTagItemKey
(
buffer
,
}
else
if
((
value
=
matchesAnMpdTagItemKey
(
buffer
,
...
@@ -148,7 +152,7 @@ void readSongInfoIntoList(FILE *fp, struct songvec *sv,
...
@@ -148,7 +152,7 @@ void readSongInfoIntoList(FILE *fp, struct songvec *sv,
song
->
mtime
=
atoi
(
&
(
buffer
[
strlen
(
SONG_MTIME
)]));
song
->
mtime
=
atoi
(
&
(
buffer
[
strlen
(
SONG_MTIME
)]));
}
}
else
else
FATAL
(
"songinfo: unknown line in db: %s
\n
"
,
buffer
);
g_error
(
"unknown line in db: %s
"
,
buffer
);
}
}
if
(
song
)
if
(
song
)
...
...
src/tag.c
View file @
a899c210
...
@@ -20,7 +20,6 @@
...
@@ -20,7 +20,6 @@
#include "tag.h"
#include "tag.h"
#include "tag_internal.h"
#include "tag_internal.h"
#include "tag_pool.h"
#include "tag_pool.h"
#include "log.h"
#include "conf.h"
#include "conf.h"
#include "song.h"
#include "song.h"
...
@@ -106,8 +105,8 @@ void tag_lib_init(void)
...
@@ -106,8 +105,8 @@ void tag_lib_init(void)
}
}
}
}
if
(
strlen
(
c
)
&&
i
==
TAG_NUM_OF_ITEM_TYPES
)
{
if
(
strlen
(
c
)
&&
i
==
TAG_NUM_OF_ITEM_TYPES
)
{
FATAL
(
"error parsing metadata item
\"
%s
\"\n
"
,
g_error
(
"error parsing metadata item
\"
%s
\"
"
,
c
);
c
);
}
}
s
++
;
s
++
;
c
=
s
;
c
=
s
;
...
...
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