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
751a8a34
Commit
751a8a34
authored
Mar 17, 2011
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tdb2: use vasprintf.
parent
e5bb37ea
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
13 deletions
+8
-13
ccan/tdb2/_info
ccan/tdb2/_info
+1
-0
ccan/tdb2/tdb.c
ccan/tdb2/tdb.c
+6
-10
ccan/tdb2/test/failtest_helper.c
ccan/tdb2/test/failtest_helper.c
+0
-1
ccan/tdb2/test/failtest_helper.h
ccan/tdb2/test/failtest_helper.h
+1
-2
No files found.
ccan/tdb2/_info
View file @
751a8a34
...
...
@@ -76,6 +76,7 @@ int main(int argc, char *argv[])
return 1;
if (strcmp(argv[1], "depends") == 0) {
printf("ccan/asprintf\n");
printf("ccan/hash\n");
printf("ccan/likely\n");
printf("ccan/asearch\n");
...
...
ccan/tdb2/tdb.c
View file @
751a8a34
#include "private.h"
#include <ccan/asprintf/asprintf.h>
#include <ccan/tdb2/tdb2.h>
#include <assert.h>
#include <stdarg.h>
...
...
@@ -756,23 +757,18 @@ enum TDB_ERROR COLD tdb_logerr(struct tdb_context *tdb,
if
(
!
tdb
->
logfn
)
return
ecode
;
/* FIXME: Doesn't assume asprintf. */
va_start
(
ap
,
fmt
);
len
=
v
snprintf
(
NULL
,
0
,
fmt
,
ap
);
len
=
v
asprintf
(
&
message
,
fmt
,
ap
);
va_end
(
ap
);
message
=
malloc
(
len
+
1
);
if
(
!
message
)
{
if
(
len
<
0
)
{
tdb
->
logfn
(
tdb
,
TDB_LOG_ERROR
,
tdb
->
log_private
,
"out of memory formatting message:"
);
tdb
->
logfn
(
tdb
,
level
,
tdb
->
log_private
,
fmt
);
return
ecode
;
}
else
{
tdb
->
logfn
(
tdb
,
level
,
tdb
->
log_private
,
message
);
free
(
message
);
}
va_start
(
ap
,
fmt
);
len
=
vsprintf
(
message
,
fmt
,
ap
);
va_end
(
ap
);
tdb
->
logfn
(
tdb
,
level
,
tdb
->
log_private
,
message
);
free
(
message
);
errno
=
saved_errno
;
return
ecode
;
}
ccan/tdb2/test/failtest_helper.c
View file @
751a8a34
...
...
@@ -85,7 +85,6 @@ block_repeat_failures(struct failtest_call *history, unsigned num)
const
struct
failtest_call
*
i
,
*
last
=
&
history
[
num
-
1
];
if
(
failmatch
(
last
,
INITIAL_TDB_MALLOC
)
||
failmatch
(
last
,
LOGGING_MALLOC
)
||
failmatch
(
last
,
URANDOM_OPEN
)
||
failmatch
(
last
,
URANDOM_READ
))
{
if
(
find_repeat
(
history
,
last
,
last
))
...
...
ccan/tdb2/test/failtest_helper.h
View file @
751a8a34
...
...
@@ -4,8 +4,7 @@
#include <stdbool.h>
/* FIXME: Check these! */
#define INITIAL_TDB_MALLOC "tdb.c", 189, FAILTEST_MALLOC
#define LOGGING_MALLOC "tdb.c", 766, FAILTEST_MALLOC
#define INITIAL_TDB_MALLOC "tdb.c", 190, FAILTEST_MALLOC
#define URANDOM_OPEN "tdb.c", 49, FAILTEST_OPEN
#define URANDOM_READ "tdb.c", 29, FAILTEST_READ
...
...
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