[klibc] [klibc:master] readlink: Reduce size by calling _fwrite() instead of puts()
klibc-bot for H. Peter Anvin
hpa at linux.intel.com
Tue Apr 15 13:27:03 PDT 2014
Commit-ID: 06e395cd75dc79289ae789c146795189c32babd8
Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=06e395cd75dc79289ae789c146795189c32babd8
Author: H. Peter Anvin <hpa at linux.intel.com>
AuthorDate: Tue, 15 Apr 2014 13:23:49 -0700
Committer: H. Peter Anvin <hpa at linux.intel.com>
CommitDate: Tue, 15 Apr 2014 13:23:49 -0700
readlink: Reduce size by calling _fwrite() instead of puts()
We know how long the output is, so we might as well call _fwrite()
directly, with the explicit termination set to \n instead of \0.
Signed-off-by: H. Peter Anvin <hpa at linux.intel.com>
---
usr/utils/readlink.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/usr/utils/readlink.c b/usr/utils/readlink.c
index bf9501b..4e3cfcb 100644
--- a/usr/utils/readlink.c
+++ b/usr/utils/readlink.c
@@ -29,8 +29,8 @@ int main(int argc, char *argv[])
perror(name);
exit(1);
}
- link_name[rv] = '\0';
- puts(link_name);
+ link_name[rv] = '\n';
+ _fwrite(link_name, rv+1, stdout);
}
return 0;
More information about the klibc
mailing list