Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Quanah Gibson-Mount
OpenLDAP
Commits
cd51428d
Commit
cd51428d
authored
Sep 07, 2001
by
Kurt Zeilenga
Browse files
Add IDL debugging code from SuSE.
parent
35883521
Changes
1
Hide whitespace changes
Inline
Side-by-side
servers/slapd/back-ldbm/idl.c
View file @
cd51428d
...
...
@@ -45,6 +45,27 @@ static void cont_free( Datum *cont )
ch_free
(
cont
->
dptr
);
}
#ifdef LDBM_DEBUG_IDL
static
void
idl_check
(
ID_BLOCK
*
idl
)
{
int
i
;
ID_BLOCK
last
;
if
(
ID_BLOCK_INDIRECT
(
idl
)
||
ID_BLOCK_ALLIDS
(
idl
)
||
ID_BLOCK_NIDS
(
idl
)
<=
1
)
{
return
;
}
for
(
last
=
ID_BLOCK_ID
(
idl
,
0
),
i
=
1
;
i
<
ID_BLOCK_NIDS
(
idl
);
last
=
ID_BLOCK_ID
(
idl
,
i
),
i
++
)
{
assert
(
last
<
ID_BLOCK_ID
(
idl
,
i
)
);
}
}
#endif
/* Allocate an ID_BLOCK with room for nids ids */
ID_BLOCK
*
idl_alloc
(
unsigned
int
nids
)
...
...
@@ -222,6 +243,10 @@ idl_fetch(
}
free
(
(
char
*
)
tmp
);
#ifdef LDBM_DEBUG_IDL
idl_check
(
idl
);
#endif
#ifdef NEW_LOGGING
LDAP_LOG
((
"cache"
,
LDAP_LEVEL_ENTRY
,
"idl_fetch: %ld ids (%ld max)
\n
"
,
...
...
@@ -248,6 +273,10 @@ idl_store(
Datum
data
;
struct
ldbminfo
*
li
=
(
struct
ldbminfo
*
)
be
->
be_private
;
#ifdef LDBM_DEBUG_IDL
idl_check
(
idl
);
#endif
ldbm_datum_init
(
data
);
/* Debug( LDAP_DEBUG_TRACE, "=> idl_store\n", 0, 0, 0 ); */
...
...
@@ -312,6 +341,11 @@ idl_split_block(
(
char
*
)
&
ID_BLOCK_ID
(
b
,
nr
),
nl
*
sizeof
(
ID
)
);
ID_BLOCK_NIDS
(
*
left
)
=
nl
+
(
nr
==
0
?
0
:
1
);
#ifdef LDBM_DEBUG_IDL
idl_check
(
*
right
);
idl_check
(
*
left
);
#endif
}
...
...
@@ -771,6 +805,10 @@ idl_insert( ID_BLOCK **idl, ID id, unsigned int maxids )
'\0'
,
(
ID_BLOCK_NMAX
(
*
idl
)
-
ID_BLOCK_NIDS
(
*
idl
))
*
sizeof
(
ID
)
);
#ifdef LDBM_DEBUG_IDL
idl_check
(
*
idl
);
#endif
return
(
i
==
0
?
1
:
0
);
/* inserted - first id changed or not */
}
...
...
@@ -911,6 +949,10 @@ idl_dup( ID_BLOCK *idl )
(
char
*
)
idl
,
(
ID_BLOCK_NMAX
(
idl
)
+
ID_BLOCK_IDS_OFFSET
)
*
sizeof
(
ID
)
);
#ifdef LDBM_DEBUG_IDL
idl_check
(
new
);
#endif
return
(
new
);
}
...
...
@@ -948,6 +990,11 @@ idl_intersection(
n
=
idl_dup
(
idl_min
(
a
,
b
)
);
#ifdef LDBM_DEBUG_IDL
idl_check
(
a
);
idl_check
(
b
);
#endif
for
(
ni
=
0
,
ai
=
0
,
bi
=
0
;
ai
<
ID_BLOCK_NIDS
(
a
);
ai
++
)
{
for
(
;
bi
<
ID_BLOCK_NIDS
(
b
)
&&
ID_BLOCK_ID
(
b
,
bi
)
<
ID_BLOCK_ID
(
a
,
ai
);
...
...
@@ -971,6 +1018,10 @@ idl_intersection(
}
ID_BLOCK_NIDS
(
n
)
=
ni
;
#ifdef LDBM_DEBUG_IDL
idl_check
(
n
);
#endif
return
(
n
);
}
...
...
@@ -998,6 +1049,11 @@ idl_union(
return
(
idl_allids
(
be
)
);
}
#ifdef LDBM_DEBUG_IDL
idl_check
(
a
);
idl_check
(
b
);
#endif
if
(
ID_BLOCK_NIDS
(
b
)
<
ID_BLOCK_NIDS
(
a
)
)
{
n
=
a
;
a
=
b
;
...
...
@@ -1030,6 +1086,10 @@ idl_union(
}
ID_BLOCK_NIDS
(
n
)
=
ni
;
#ifdef LDBM_DEBUG_IDL
idl_check
(
n
);
#endif
return
(
n
);
}
...
...
@@ -1107,6 +1167,10 @@ idl_notin(
}
ID_BLOCK_NIDS
(
n
)
=
ni
;
#ifdef LDBM_DEBUG_IDL
idl_check
(
n
);
#endif
return
(
n
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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