Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dmitry Baryshkov
nettle
Commits
785a6631
Commit
785a6631
authored
Feb 07, 2004
by
Niels Möller
Browse files
(xalloc): New function.
(main): Use xalloc. Rev: src/nettle/tools/sexp-conv.c:1.15
parent
de5c0855
Changes
1
Hide whitespace changes
Inline
Side-by-side
tools/sexp-conv.c
View file @
785a6631
...
...
@@ -44,6 +44,19 @@
#define BUG_ADDRESS "nettle-bugs@lists.lysator.liu.se"
static
void
*
xalloc
(
size_t
size
)
{
void
*
p
=
malloc
(
size
);
if
(
!
p
)
{
fprintf
(
stderr
,
"Virtual memory exhausted.
\n
"
);
abort
();
}
return
p
;
}
/* Conversion functions. */
...
...
@@ -318,7 +331,7 @@ main(int argc, char **argv)
struct
sexp_parser
parser
;
struct
sexp_compound_token
token
;
struct
sexp_output
output
;
parse_options
(
&
options
,
argc
,
argv
);
sexp_input_init
(
&
input
,
stdin
);
...
...
@@ -328,9 +341,11 @@ main(int argc, char **argv)
options
.
width
,
options
.
prefer_hex
);
if
(
options
.
hash
)
sexp_output_hash_init
(
&
output
,
options
.
hash
,
alloca
(
options
.
hash
->
context_size
));
{
/* Leaks the context, but that doesn't matter */
void
*
ctx
=
xalloc
(
options
.
hash
->
context_size
);
sexp_output_hash_init
(
&
output
,
options
.
hash
,
ctx
);
}
sexp_get_char
(
&
input
);
...
...
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