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.
This commit is contained in:
Jeff Johnston 2008-11-19 20:04:09 +00:00
parent 34ff0a4e6f
commit e231c7dae9
2 changed files with 9 additions and 6 deletions

View File

@ -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> 2008-11-19 Ralf Corsepius <ralf.corsepius@rtems.org>
* libc/include/sys/config.h: Don't put * libc/include/sys/config.h: Don't put

View File

@ -175,14 +175,12 @@ __collate_strdup(s)
void void
__collate_err(int ex, const char *f) __collate_err(int ex, const char *f)
{ {
const char *s = strdup("collate_error"); const char *s;
int serrno = errno; int serrno = errno;
write(STDERR_FILENO, s, strlen(s)); /* Be careful to change write counts if you change the strings */
write(STDERR_FILENO, ": ", 2); write(STDERR_FILENO, "collate_error: ", 15);
free(s); write(STDERR_FILENO, f, strlen(f));
s = f;
write(STDERR_FILENO, s, strlen(s));
write(STDERR_FILENO, ": ", 2); write(STDERR_FILENO, ": ", 2);
s = strerror(serrno); s = strerror(serrno);
write(STDERR_FILENO, s, strlen(s)); write(STDERR_FILENO, s, strlen(s));