Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
nettle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Wim Lewis
nettle
Commits
ce79d3e1
Commit
ce79d3e1
authored
13 years ago
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
examples/io.c: Made write_file use write_string.
parent
a1b48f8e
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
ChangeLog
+2
-0
2 additions, 0 deletions
ChangeLog
examples/io.c
+11
-15
11 additions, 15 deletions
examples/io.c
with
13 additions
and
15 deletions
ChangeLog
+
2
−
0
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.
...
...
This diff is collapsed.
Click to expand it.
examples/io.c
+
11
−
15
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
;
return
res
==
size
;
if
(
!
f
)
return
0
;
res
=
write_string
(
f
,
size
,
buffer
);
return
fclose
(
f
)
==
0
&&
res
;
}
int
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment