Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Joe Martin
OpenLDAP
Commits
cb7c9552
Commit
cb7c9552
authored
Aug 19, 2011
by
Hallvard Furuseth
Committed by
Howard Chu
Sep 01, 2011
Browse files
Simplify: Replace IDL*_CMP() with CMP()
parent
3029bb69
Changes
1
Hide whitespace changes
Inline
Side-by-side
libraries/libmdb/midl.c
View file @
cb7c9552
...
...
@@ -21,11 +21,7 @@
typedef
unsigned
long
pgno_t
;
/* Sort the IDLs from highest to lowest */
#define IDL_CMP(x,y) ( (x) > (y) ? -1 : (x) < (y) )
/* Sort the IDL2s from lowest to highest */
#define IDL2_CMP(x,y) ( (x) < (y) ? -1 : (x) > (y) )
#define CMP(x,y) ( (x) > (y) ? -1 : (x) < (y) )
unsigned
mdb_midl_search
(
ID
*
ids
,
ID
id
)
{
...
...
@@ -42,7 +38,7 @@ unsigned mdb_midl_search( ID *ids, ID id )
while
(
0
<
n
)
{
int
pivot
=
n
>>
1
;
cursor
=
base
+
pivot
;
val
=
IDL_
CMP
(
id
,
ids
[
cursor
+
1
]
);
val
=
CMP
(
id
,
ids
[
cursor
+
1
]
);
if
(
val
<
0
)
{
n
=
pivot
;
...
...
@@ -127,7 +123,7 @@ unsigned mdb_midl2_search( MIDL2 *ids, MIDL2 *id )
while
(
0
<
n
)
{
int
pivot
=
n
>>
1
;
cursor
=
base
+
pivot
;
val
=
IDL2_
CMP
(
id
->
mid
,
ids
[
cursor
+
1
].
mid
);
val
=
CMP
(
ids
[
cursor
+
1
].
mid
,
id
->
mid
);
if
(
val
<
0
)
{
n
=
pivot
;
...
...
Write
Preview
Supports
Markdown
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