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
27205857
Commit
27205857
authored
Dec 02, 2008
by
Thomas Jansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replaced mpd_likely/mpd_unlikely by G_LIKELY/G_UNLIKELY
We want to remove gcc.h eventually. This takes care of all the G_LIKELY/G_UNLIKELY macros.
parent
4ca24f22
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
16 deletions
+18
-16
path.c
src/path.c
+1
-1
pcm_utils.c
src/pcm_utils.c
+3
-2
state_file.c
src/state_file.c
+3
-3
tag_id3.c
src/tag_id3.c
+2
-2
utils.c
src/utils.c
+8
-7
volume.c
src/volume.c
+1
-1
No files found.
src/path.c
View file @
27205857
...
@@ -110,7 +110,7 @@ char *pfx_dir(char *dst,
...
@@ -110,7 +110,7 @@ char *pfx_dir(char *dst,
const
char
*
path
,
const
size_t
path_len
,
const
char
*
path
,
const
size_t
path_len
,
const
char
*
pfx
,
const
size_t
pfx_len
)
const
char
*
pfx
,
const
size_t
pfx_len
)
{
{
if
(
mpd_unlikely
((
pfx_len
+
path_len
+
1
)
>=
MPD_PATH_MAX
))
if
(
G_UNLIKELY
((
pfx_len
+
path_len
+
1
)
>=
MPD_PATH_MAX
))
FATAL
(
"Cannot prefix '%s' to '%s', PATH_MAX: %d
\n
"
,
FATAL
(
"Cannot prefix '%s' to '%s', PATH_MAX: %d
\n
"
,
pfx
,
path
,
MPD_PATH_MAX
);
pfx
,
path
,
MPD_PATH_MAX
);
...
...
src/pcm_utils.c
View file @
27205857
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#include <assert.h>
#include <assert.h>
#include <string.h>
#include <string.h>
#include <math.h>
#include <math.h>
#include <glib.h>
static
inline
int
static
inline
int
pcm_dither
(
void
)
pcm_dither
(
void
)
...
@@ -40,9 +41,9 @@ pcm_dither(void)
...
@@ -40,9 +41,9 @@ pcm_dither(void)
static
int32_t
static
int32_t
pcm_range
(
int32_t
sample
,
unsigned
bits
)
pcm_range
(
int32_t
sample
,
unsigned
bits
)
{
{
if
(
mpd_unlikely
(
sample
<
(
-
1
<<
(
bits
-
1
))))
if
(
G_UNLIKELY
(
sample
<
(
-
1
<<
(
bits
-
1
))))
return
-
1
<<
(
bits
-
1
);
return
-
1
<<
(
bits
-
1
);
if
(
mpd_unlikely
(
sample
>=
(
1
<<
(
bits
-
1
))))
if
(
G_UNLIKELY
(
sample
>=
(
1
<<
(
bits
-
1
))))
return
(
1
<<
(
bits
-
1
))
-
1
;
return
(
1
<<
(
bits
-
1
))
-
1
;
return
sample
;
return
sample
;
}
}
...
...
src/state_file.c
View file @
27205857
...
@@ -19,13 +19,13 @@
...
@@ -19,13 +19,13 @@
#include "../config.h"
#include "../config.h"
#include "state_file.h"
#include "state_file.h"
#include "conf.h"
#include "conf.h"
#include "gcc.h"
#include "log.h"
#include "log.h"
#include "audio.h"
#include "audio.h"
#include "playlist.h"
#include "playlist.h"
#include "utils.h"
#include "utils.h"
#include "volume.h"
#include "volume.h"
#include <glib.h>
#include <string.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/stat.h>
...
@@ -58,7 +58,7 @@ void write_state_file(void)
...
@@ -58,7 +58,7 @@ void write_state_file(void)
if
(
!
sfpath
)
if
(
!
sfpath
)
return
;
return
;
fp
=
fopen
(
sfpath
,
"w"
);
fp
=
fopen
(
sfpath
,
"w"
);
if
(
mpd_unlikely
(
!
fp
))
{
if
(
G_UNLIKELY
(
!
fp
))
{
ERROR
(
"problems opening state file
\"
%s
\"
for writing: %s
\n
"
,
ERROR
(
"problems opening state file
\"
%s
\"
for writing: %s
\n
"
,
sfpath
,
strerror
(
errno
));
sfpath
,
strerror
(
errno
));
return
;
return
;
...
@@ -87,7 +87,7 @@ void read_state_file(void)
...
@@ -87,7 +87,7 @@ void read_state_file(void)
FATAL
(
"state file
\"
%s
\"
is not a regular file
\n
"
,
sfpath
);
FATAL
(
"state file
\"
%s
\"
is not a regular file
\n
"
,
sfpath
);
while
(
!
(
fp
=
fopen
(
sfpath
,
"r"
))
&&
errno
==
EINTR
);
while
(
!
(
fp
=
fopen
(
sfpath
,
"r"
))
&&
errno
==
EINTR
);
if
(
mpd_unlikely
(
!
fp
))
{
if
(
G_UNLIKELY
(
!
fp
))
{
FATAL
(
"problems opening state file
\"
%s
\"
for reading: %s
\n
"
,
FATAL
(
"problems opening state file
\"
%s
\"
for reading: %s
\n
"
,
sfpath
,
strerror
(
errno
));
sfpath
,
strerror
(
errno
));
}
}
...
...
src/tag_id3.c
View file @
27205857
...
@@ -52,7 +52,7 @@ static id3_utf8_t * processID3FieldString (int is_id3v1, const id3_ucs4_t *ucs4,
...
@@ -52,7 +52,7 @@ static id3_utf8_t * processID3FieldString (int is_id3v1, const id3_ucs4_t *ucs4,
GError
*
error
=
NULL
;
GError
*
error
=
NULL
;
isostr
=
id3_ucs4_latin1duplicate
(
ucs4
);
isostr
=
id3_ucs4_latin1duplicate
(
ucs4
);
if
(
mpd_unlikely
(
!
isostr
))
{
if
(
G_UNLIKELY
(
!
isostr
))
{
return
NULL
;
return
NULL
;
}
}
...
@@ -70,7 +70,7 @@ static id3_utf8_t * processID3FieldString (int is_id3v1, const id3_ucs4_t *ucs4,
...
@@ -70,7 +70,7 @@ static id3_utf8_t * processID3FieldString (int is_id3v1, const id3_ucs4_t *ucs4,
free
(
isostr
);
free
(
isostr
);
}
else
{
}
else
{
utf8
=
id3_ucs4_utf8duplicate
(
ucs4
);
utf8
=
id3_ucs4_utf8duplicate
(
ucs4
);
if
(
mpd_unlikely
(
!
utf8
))
{
if
(
G_UNLIKELY
(
!
utf8
))
{
return
NULL
;
return
NULL
;
}
}
}
}
...
...
src/utils.c
View file @
27205857
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#include <sys/types.h>
#include <sys/types.h>
#include <pwd.h>
#include <pwd.h>
#include <fcntl.h>
#include <fcntl.h>
#include <glib.h>
#ifdef HAVE_IPV6
#ifdef HAVE_IPV6
#include <sys/socket.h>
#include <sys/socket.h>
...
@@ -78,7 +79,7 @@ int ipv6Supported(void)
...
@@ -78,7 +79,7 @@ int ipv6Supported(void)
mpd_malloc
char
*
xstrdup
(
const
char
*
s
)
mpd_malloc
char
*
xstrdup
(
const
char
*
s
)
{
{
char
*
ret
=
strdup
(
s
);
char
*
ret
=
strdup
(
s
);
if
(
mpd_unlikely
(
!
ret
))
if
(
G_UNLIKELY
(
!
ret
))
FATAL
(
"OOM: strdup
\n
"
);
FATAL
(
"OOM: strdup
\n
"
);
return
ret
;
return
ret
;
}
}
...
@@ -89,10 +90,10 @@ mpd_malloc void *xmalloc(size_t size)
...
@@ -89,10 +90,10 @@ mpd_malloc void *xmalloc(size_t size)
{
{
void
*
ret
;
void
*
ret
;
assert
(
mpd_likely
(
size
));
assert
(
G_LIKELY
(
size
));
ret
=
malloc
(
size
);
ret
=
malloc
(
size
);
if
(
mpd_unlikely
(
!
ret
))
if
(
G_UNLIKELY
(
!
ret
))
FATAL
(
"OOM: malloc
\n
"
);
FATAL
(
"OOM: malloc
\n
"
);
return
ret
;
return
ret
;
}
}
...
@@ -104,10 +105,10 @@ mpd_malloc void *xrealloc(void *ptr, size_t size)
...
@@ -104,10 +105,10 @@ mpd_malloc void *xrealloc(void *ptr, size_t size)
/* some C libraries return NULL when size == 0,
/* some C libraries return NULL when size == 0,
* make sure we get a free()-able pointer (free(NULL)
* make sure we get a free()-able pointer (free(NULL)
* doesn't work with all C libraries, either) */
* doesn't work with all C libraries, either) */
if
(
mpd_unlikely
(
!
ret
&&
!
size
))
if
(
G_UNLIKELY
(
!
ret
&&
!
size
))
ret
=
realloc
(
ptr
,
1
);
ret
=
realloc
(
ptr
,
1
);
if
(
mpd_unlikely
(
!
ret
))
if
(
G_UNLIKELY
(
!
ret
))
FATAL
(
"OOM: realloc
\n
"
);
FATAL
(
"OOM: realloc
\n
"
);
return
ret
;
return
ret
;
}
}
...
@@ -116,10 +117,10 @@ mpd_malloc void *xcalloc(size_t nmemb, size_t size)
...
@@ -116,10 +117,10 @@ mpd_malloc void *xcalloc(size_t nmemb, size_t size)
{
{
void
*
ret
;
void
*
ret
;
assert
(
mpd_likely
(
nmemb
&&
size
));
assert
(
G_LIKELY
(
nmemb
&&
size
));
ret
=
calloc
(
nmemb
,
size
);
ret
=
calloc
(
nmemb
,
size
);
if
(
mpd_unlikely
(
!
ret
))
if
(
G_UNLIKELY
(
!
ret
))
FATAL
(
"OOM: calloc
\n
"
);
FATAL
(
"OOM: calloc
\n
"
);
return
ret
;
return
ret
;
}
}
...
...
src/volume.c
View file @
27205857
...
@@ -526,7 +526,7 @@ void read_sw_volume_state(FILE *fp)
...
@@ -526,7 +526,7 @@ void read_sw_volume_state(FILE *fp)
if
(
!
g_str_has_prefix
(
buf
,
SW_VOLUME_STATE
))
if
(
!
g_str_has_prefix
(
buf
,
SW_VOLUME_STATE
))
continue
;
continue
;
sv
=
strtol
(
buf
+
strlen
(
SW_VOLUME_STATE
),
&
end
,
10
);
sv
=
strtol
(
buf
+
strlen
(
SW_VOLUME_STATE
),
&
end
,
10
);
if
(
mpd_likely
(
!*
end
))
if
(
G_LIKELY
(
!*
end
))
changeSoftwareVolume
(
sv
,
0
);
changeSoftwareVolume
(
sv
,
0
);
else
else
ERROR
(
"Can't parse software volume: %s
\n
"
,
buf
);
ERROR
(
"Can't parse software volume: %s
\n
"
,
buf
);
...
...
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