Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nettle
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Wim Lewis
nettle
Commits
ce79d3e1
Commit
ce79d3e1
authored
Apr 14, 2012
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
examples/io.c: Made write_file use write_string.
parent
a1b48f8e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
15 deletions
+13
-15
ChangeLog
ChangeLog
+2
-0
examples/io.c
examples/io.c
+11
-15
No files found.
ChangeLog
View file @
ce79d3e1
2012-04-14 Niels Möller <nisse@lysator.liu.se>
* examples/io.c (write_file): Use write_string.
* examples/Makefile.in (base64enc): New target. Also added missing
io.o dependency to several other targets.
...
...
examples/io.c
View file @
ce79d3e1
...
...
@@ -132,28 +132,24 @@ read_file(const char *name, unsigned max_size, char **contents)
}
int
write_
file
(
const
char
*
name
,
unsigned
size
,
const
char
*
buffer
)
write_
string
(
FILE
*
f
,
unsigned
size
,
const
char
*
buffer
)
{
FILE
*
f
=
fopen
(
name
,
"wb"
);
unsigned
res
;
if
(
!
f
)
return
0
;
res
=
fwrite
(
buffer
,
1
,
size
,
f
);
if
(
res
<
size
)
res
=
0
;
size_t
res
=
fwrite
(
buffer
,
1
,
size
,
f
);
return
fclose
(
f
)
==
0
&&
res
>
0
;
return
res
==
size
;
}
int
write_
string
(
FILE
*
f
,
unsigned
size
,
const
char
*
buffer
)
write_
file
(
const
char
*
name
,
unsigned
size
,
const
char
*
buffer
)
{
size_t
res
=
fwrite
(
buffer
,
1
,
size
,
f
);
FILE
*
f
=
fopen
(
name
,
"wb"
);
int
res
;
if
(
!
f
)
return
0
;
return
res
==
size
;
res
=
write_string
(
f
,
size
,
buffer
);
return
fclose
(
f
)
==
0
&&
res
;
}
int
...
...
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