From 541587c87986ed163d8eb60040149f5fac05e6d3 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 11 Aug 2001 09:25:47 +0000 Subject: [PATCH] Update. * assert/assert.c (set_progname): Removed. (__assert_fail): Use __progname instead of __assert_program_name. * assert/assert-perr.c (__assert_perror_fail): Likewise. --- ChangeLog | 4 ++++ assert/assert-perr.c | 7 +++---- assert/assert.c | 32 +++----------------------------- 3 files changed, 10 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index fdf3acc..0868e12 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2001-08-11 Ulrich Drepper + * assert/assert.c (set_progname): Removed. + (__assert_fail): Use __progname instead of __assert_program_name. + * assert/assert-perr.c (__assert_perror_fail): Likewise. + * malloc/malloc.c (ptmalloc_init): Don't call getenv five times. Instead use new function next_env_entry which iterates over the environment once. diff --git a/assert/assert-perr.c b/assert/assert-perr.c index c13595c..436a9ce 100644 --- a/assert/assert-perr.c +++ b/assert/assert-perr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1994,1995,1996,1997,1998,2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,7 +24,7 @@ #include -extern const char *__assert_program_name; /* In assert.c. */ +extern const char *__progname; #ifdef USE_IN_LIBIO # include @@ -52,8 +52,7 @@ __assert_perror_fail (int errnum, /* Print the message. */ (void) fprintf (stderr, _("%s%s%s:%u: %s%sUnexpected error: %s.\n"), - __assert_program_name ? __assert_program_name : "", - __assert_program_name ? ": " : "", + __progname, __progname[0] ? ": " : "", file, line, function ? function : "", function ? ": " : "", __strerror_r (errnum, errbuf, sizeof errbuf)); diff --git a/assert/assert.c b/assert/assert.c index 0db8795..81ad080 100644 --- a/assert/assert.c +++ b/assert/assert.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1994, 1995, 1996, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1991,1994,1995,1996,1998,2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -23,7 +23,7 @@ #include -const char *__assert_program_name; +extern const char *__progname; #ifdef USE_IN_LIBIO # include @@ -50,8 +50,7 @@ __assert_fail (const char *assertion, const char *file, unsigned int line, /* Print the message. */ (void) fprintf (stderr, _("%s%s%s:%u: %s%sAssertion `%s' failed.\n"), - __assert_program_name ? __assert_program_name : "", - __assert_program_name ? ": " : "", + __progname, __progname[0] ? ": " : "", file, line, function ? function : "", function ? ": " : "", assertion); @@ -59,28 +58,3 @@ __assert_fail (const char *assertion, const char *file, unsigned int line, abort (); } - -#ifdef HAVE_GNU_LD - -#include - -static void -set_progname (int argc, char **argv, char **envp) -{ - char *p; - - if (argv && argv[0]) - { - p = strrchr (argv[0], '/'); - if (p == NULL) - __assert_program_name = argv[0]; - else - __assert_program_name = p + 1; - } - - (void) &set_progname; /* Avoid "defined but not used" warning. */ -} - -text_set_element (__libc_subinit, set_progname); - -#endif -- 2.7.4