diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2008-11-19 23:04:09 +0300 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2008-11-19 23:04:09 +0300 |
commit | e231c7dae90002f4aa9a6e8bdb445a0bd6c392ae (patch) | |
tree | e7f42c987bff21b7838c2b2d672256f40a7fab6d /newlib | |
parent | 34ff0a4e6fab8521d3ae67394982eb63c7daf967 (diff) |
2008-11-19 Craig Howland <howland@LGSInnovations.com>
* libc/unix/collate.c (__collate_err): simplify to remove unnecessary
strdup() and strlen() calls, also getting rid of a compiler warning.
Diffstat (limited to 'newlib')
-rw-r--r-- | newlib/ChangeLog | 5 | ||||
-rw-r--r-- | newlib/libc/posix/collate.c | 10 |
2 files changed, 9 insertions, 6 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog index f253b1cab..f8b1ccc5c 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,8 @@ +2008-11-19 Craig Howland <howland@LGSInnovations.com> + + * libc/unix/collate.c (__collate_err): simplify to remove unnecessary + strdup() and strlen() calls, also getting rid of a compiler warning. + 2008-11-19 Ralf Corsepius <ralf.corsepius@rtems.org> * libc/include/sys/config.h: Don't put diff --git a/newlib/libc/posix/collate.c b/newlib/libc/posix/collate.c index 4e717bc39..8af8970c9 100644 --- a/newlib/libc/posix/collate.c +++ b/newlib/libc/posix/collate.c @@ -175,14 +175,12 @@ __collate_strdup(s) void __collate_err(int ex, const char *f) { - const char *s = strdup("collate_error"); + const char *s; int serrno = errno; - write(STDERR_FILENO, s, strlen(s)); - write(STDERR_FILENO, ": ", 2); - free(s); - s = f; - write(STDERR_FILENO, s, strlen(s)); + /* Be careful to change write counts if you change the strings */ + write(STDERR_FILENO, "collate_error: ", 15); + write(STDERR_FILENO, f, strlen(f)); write(STDERR_FILENO, ": ", 2); s = strerror(serrno); write(STDERR_FILENO, s, strlen(s)); |