Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ccan
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
mirror
ccan
Commits
156e5eb9
Commit
156e5eb9
authored
Apr 07, 2011
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tdb2: rename internal hashfn and logfn to hash_fn and log_fn.
We use underscores everywhere else, so be consistent.
parent
007a7e4e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
20 deletions
+20
-20
ccan/tdb2/hash.c
ccan/tdb2/hash.c
+2
-2
ccan/tdb2/open.c
ccan/tdb2/open.c
+7
-7
ccan/tdb2/private.h
ccan/tdb2/private.h
+5
-5
ccan/tdb2/tdb.c
ccan/tdb2/tdb.c
+5
-5
ccan/tdb2/test/run-001-encode.c
ccan/tdb2/test/run-001-encode.c
+1
-1
No files found.
ccan/tdb2/hash.c
View file @
156e5eb9
...
...
@@ -31,12 +31,12 @@ static uint64_t jenkins_hash(const void *key, size_t length, uint64_t seed,
void
tdb_hash_init
(
struct
tdb_context
*
tdb
)
{
tdb
->
hashfn
=
jenkins_hash
;
tdb
->
hash
_
fn
=
jenkins_hash
;
}
uint64_t
tdb_hash
(
struct
tdb_context
*
tdb
,
const
void
*
ptr
,
size_t
len
)
{
return
tdb
->
hashfn
(
ptr
,
len
,
tdb
->
hash_seed
,
tdb
->
hash_data
);
return
tdb
->
hash
_
fn
(
ptr
,
len
,
tdb
->
hash_seed
,
tdb
->
hash_data
);
}
uint64_t
hash_record
(
struct
tdb_context
*
tdb
,
tdb_off_t
off
)
...
...
ccan/tdb2/open.c
View file @
156e5eb9
...
...
@@ -101,10 +101,10 @@ static enum TDB_ERROR tdb_new_database(struct tdb_context *tdb,
else
newdb
.
hdr
.
hash_seed
=
random_number
(
tdb
);
newdb
.
hdr
.
hash_test
=
TDB_HASH_MAGIC
;
newdb
.
hdr
.
hash_test
=
tdb
->
hashfn
(
&
newdb
.
hdr
.
hash_test
,
sizeof
(
newdb
.
hdr
.
hash_test
),
newdb
.
hdr
.
hash_seed
,
tdb
->
hash_data
);
newdb
.
hdr
.
hash_test
=
tdb
->
hash
_
fn
(
&
newdb
.
hdr
.
hash_test
,
sizeof
(
newdb
.
hdr
.
hash_test
),
newdb
.
hdr
.
hash_seed
,
tdb
->
hash_data
);
newdb
.
hdr
.
recovery
=
0
;
newdb
.
hdr
.
features_used
=
newdb
.
hdr
.
features_offered
=
TDB_FEATURE_MASK
;
newdb
.
hdr
.
seqnum
=
0
;
...
...
@@ -205,7 +205,7 @@ struct tdb_context *tdb_open(const char *name, int tdb_flags,
tdb
->
name
=
NULL
;
tdb
->
direct_access
=
0
;
tdb
->
flags
=
tdb_flags
;
tdb
->
logfn
=
NULL
;
tdb
->
log
_
fn
=
NULL
;
tdb
->
transaction
=
NULL
;
tdb
->
stats
=
NULL
;
tdb
->
access
=
NULL
;
...
...
@@ -217,11 +217,11 @@ struct tdb_context *tdb_open(const char *name, int tdb_flags,
while
(
attr
)
{
switch
(
attr
->
base
.
attr
)
{
case
TDB_ATTRIBUTE_LOG
:
tdb
->
logfn
=
attr
->
log
.
fn
;
tdb
->
log
_
fn
=
attr
->
log
.
fn
;
tdb
->
log_data
=
attr
->
log
.
data
;
break
;
case
TDB_ATTRIBUTE_HASH
:
tdb
->
hashfn
=
attr
->
hash
.
fn
;
tdb
->
hash
_
fn
=
attr
->
hash
.
fn
;
tdb
->
hash_data
=
attr
->
hash
.
data
;
break
;
case
TDB_ATTRIBUTE_SEED
:
...
...
ccan/tdb2/private.h
View file @
156e5eb9
...
...
@@ -365,14 +365,14 @@ struct tdb_context {
uint32_t
flags
;
/* Logging function */
void
(
*
logfn
)(
struct
tdb_context
*
tdb
,
enum
tdb_log_level
level
,
void
*
data
,
const
char
*
message
);
void
(
*
log
_
fn
)(
struct
tdb_context
*
tdb
,
enum
tdb_log_level
level
,
void
*
data
,
const
char
*
message
);
void
*
log_data
;
/* Hash function. */
uint64_t
(
*
hashfn
)(
const
void
*
key
,
size_t
len
,
uint64_t
seed
,
void
*
);
uint64_t
(
*
hash
_
fn
)(
const
void
*
key
,
size_t
len
,
uint64_t
seed
,
void
*
);
void
*
hash_data
;
uint64_t
hash_seed
;
...
...
ccan/tdb2/tdb.c
View file @
156e5eb9
...
...
@@ -398,7 +398,7 @@ enum TDB_ERROR COLD tdb_logerr(struct tdb_context *tdb,
/* tdb_open paths care about errno, so save it. */
int
saved_errno
=
errno
;
if
(
!
tdb
->
logfn
)
if
(
!
tdb
->
log
_
fn
)
return
ecode
;
va_start
(
ap
,
fmt
);
...
...
@@ -406,11 +406,11 @@ enum TDB_ERROR COLD tdb_logerr(struct tdb_context *tdb,
va_end
(
ap
);
if
(
len
<
0
)
{
tdb
->
logfn
(
tdb
,
TDB_LOG_ERROR
,
tdb
->
log_data
,
"out of memory formatting message:"
);
tdb
->
logfn
(
tdb
,
level
,
tdb
->
log_data
,
fmt
);
tdb
->
log
_
fn
(
tdb
,
TDB_LOG_ERROR
,
tdb
->
log_data
,
"out of memory formatting message:"
);
tdb
->
log
_
fn
(
tdb
,
level
,
tdb
->
log_data
,
fmt
);
}
else
{
tdb
->
logfn
(
tdb
,
level
,
tdb
->
log_data
,
message
);
tdb
->
log
_
fn
(
tdb
,
level
,
tdb
->
log_data
,
message
);
free
(
message
);
}
errno
=
saved_errno
;
...
...
ccan/tdb2/test/run-001-encode.c
View file @
156e5eb9
...
...
@@ -13,7 +13,7 @@ int main(int argc, char *argv[])
{
unsigned
int
i
;
struct
tdb_used_record
rec
;
struct
tdb_context
tdb
=
{
.
logfn
=
tap_log_fn
};
struct
tdb_context
tdb
=
{
.
log
_
fn
=
tap_log_fn
};
plan_tests
(
64
+
32
+
48
*
6
+
1
);
...
...
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