Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
babeld
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
babeld
Commits
35f01778
Commit
35f01778
authored
Oct 19, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add sundry GCC-isms.
parent
324bfb30
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
8 deletions
+18
-8
babel.c
babel.c
+1
-1
babel.h
babel.h
+11
-1
util.h
util.h
+6
-6
No files found.
babel.c
View file @
35f01778
...
@@ -712,7 +712,7 @@ main(int argc, char **argv)
...
@@ -712,7 +712,7 @@ main(int argc, char **argv)
}
}
}
}
if
(
debug
||
dumping
)
{
if
(
UNLIKELY
(
debug
||
dumping
)
)
{
dump_tables
(
stdout
);
dump_tables
(
stdout
);
dumping
=
0
;
dumping
=
0
;
}
}
...
...
babel.h
View file @
35f01778
...
@@ -35,9 +35,19 @@ THE SOFTWARE.
...
@@ -35,9 +35,19 @@ THE SOFTWARE.
#define MIN(x,y) ((x)<=(y)?(x):(y))
#define MIN(x,y) ((x)<=(y)?(x):(y))
#if defined(__GNUC__) && (__GNUC__ >= 3)
#if defined(__GNUC__) && (__GNUC__ >= 3)
#define ATTRIBUTE(x) __attribute__(x)
#define ATTRIBUTE(x) __attribute__ (x)
#define LIKELY(_x) __builtin_expect(!!(_x), 1)
#define UNLIKELY(_x) __builtin_expect(!!(_x), 0)
#else
#else
#define ATTRIBUTE(x)
/**/
#define ATTRIBUTE(x)
/**/
#define LIKELY(_x) !!(_x)
#define UNLIKELY(_x) !!(x)
#endif
#if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR >= 3)
#define COLD __attribute__ ((cold))
#else
#define COLD
/**/
#endif
#endif
#ifndef IF_NAMESIZE
#ifndef IF_NAMESIZE
...
...
util.h
View file @
35f01778
...
@@ -56,7 +56,7 @@ void timeval_min(struct timeval *d, const struct timeval *s);
...
@@ -56,7 +56,7 @@ void timeval_min(struct timeval *d, const struct timeval *s);
void
timeval_min_sec
(
struct
timeval
*
d
,
time_t
secs
);
void
timeval_min_sec
(
struct
timeval
*
d
,
time_t
secs
);
int
parse_msec
(
const
char
*
string
)
ATTRIBUTE
((
pure
));
int
parse_msec
(
const
char
*
string
)
ATTRIBUTE
((
pure
));
void
do_debugf
(
int
leve
,
const
char
*
format
,
...)
void
do_debugf
(
int
leve
,
const
char
*
format
,
...)
ATTRIBUTE
((
format
(
printf
,
2
,
3
)));
ATTRIBUTE
((
format
(
printf
,
2
,
3
)))
COLD
;
int
in_prefix
(
const
unsigned
char
*
address
,
int
in_prefix
(
const
unsigned
char
*
address
,
const
unsigned
char
*
prefix
,
unsigned
char
plen
)
const
unsigned
char
*
prefix
,
unsigned
char
plen
)
ATTRIBUTE
((
pure
));
ATTRIBUTE
((
pure
));
...
@@ -64,7 +64,7 @@ unsigned char *mask_prefix(unsigned char *ret,
...
@@ -64,7 +64,7 @@ unsigned char *mask_prefix(unsigned char *ret,
const
unsigned
char
*
prefix
,
unsigned
char
plen
);
const
unsigned
char
*
prefix
,
unsigned
char
plen
);
const
char
*
format_address
(
const
unsigned
char
*
address
);
const
char
*
format_address
(
const
unsigned
char
*
address
);
const
char
*
format_prefix
(
const
unsigned
char
*
address
,
unsigned
char
prefix
);
const
char
*
format_prefix
(
const
unsigned
char
*
address
,
unsigned
char
prefix
);
const
char
*
format_eui64
(
const
unsigned
char
*
eui
);
const
char
*
format_eui64
(
const
unsigned
char
*
eui
);
int
parse_address
(
const
char
*
address
,
unsigned
char
*
addr_r
,
int
*
af_r
);
int
parse_address
(
const
char
*
address
,
unsigned
char
*
addr_r
,
int
*
af_r
);
int
parse_net
(
const
char
*
net
,
unsigned
char
*
prefix_r
,
unsigned
char
*
plen_r
,
int
parse_net
(
const
char
*
net
,
unsigned
char
*
prefix_r
,
unsigned
char
*
plen_r
,
int
*
af_r
);
int
*
af_r
);
...
@@ -84,20 +84,20 @@ static void ATTRIBUTE ((used)) kdebugf(const char *format, ...) { return; }
...
@@ -84,20 +84,20 @@ static void ATTRIBUTE ((used)) kdebugf(const char *format, ...) { return; }
#elif defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
#elif defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
#define debugf(...) \
#define debugf(...) \
do { \
do { \
if(
debug >= 2) do_debugf(2, __VA_ARGS__);
\
if(
UNLIKELY(debug >= 2)) do_debugf(2, __VA_ARGS__);
\
} while(0)
} while(0)
#define kdebugf(...) \
#define kdebugf(...) \
do { \
do { \
if(
debug >= 3) do_debugf(3, __VA_ARGS__);
\
if(
UNLIKELY(debug >= 3)) do_debugf(3, __VA_ARGS__);
\
} while(0)
} while(0)
#elif defined __GNUC__
#elif defined __GNUC__
#define debugf(_args...) \
#define debugf(_args...) \
do { \
do { \
if(
debug >= 2) do_debugf(2, _args);
\
if(
UNLIKELY(debug >= 2)) do_debugf(2, _args);
\
} while(0)
} while(0)
#define kdebugf(_args...) \
#define kdebugf(_args...) \
do { \
do { \
if(
debug >= 3) do_debugf(3, _args);
\
if(
UNLIKELY(debug >= 3)) do_debugf(3, _args);
\
} while(0)
} while(0)
#else
#else
static
void
debugf
(
const
char
*
format
,
...)
{
return
;
}
static
void
debugf
(
const
char
*
format
,
...)
{
return
;
}
...
...
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