Skip to content

Commit

Permalink
Update.
Browse files Browse the repository at this point in the history
	* intl/Makefile (tests): Depend in mtrace-tst-gettext.
	Make this a new rule depending on tst-gettext.out and run mtrace.
	* intl/tst-gettext.c: Call mtrace.
	* intl/tst-gettext.sh: Put MALLOC_TRACE in environment of tst-gettext.

	* elf/dl-reloc.c: Add a few more __builtin_expect.

	* configure.in: Remove --with-gettext option.

	* intl/dcigettext.c (free_mem): Correct freeing of
	_nl_domain_bindings list.
  • Loading branch information
Ulrich Drepper committed Aug 31, 2000
1 parent 69071b2 commit 55e2d5c
Show file tree
Hide file tree
Showing 8 changed files with 144 additions and 173 deletions.
12 changes: 12 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
2000-08-31 Ulrich Drepper <drepper@redhat.com>

* intl/Makefile (tests): Depend in mtrace-tst-gettext.
Make this a new rule depending on tst-gettext.out and run mtrace.
* intl/tst-gettext.c: Call mtrace.
* intl/tst-gettext.sh: Put MALLOC_TRACE in environment of tst-gettext.

* elf/dl-reloc.c: Add a few more __builtin_expect.

* configure.in: Remove --with-gettext option.

* intl/dcigettext.c (free_mem): Correct freeing of
_nl_domain_bindings list.

* sysdeps/generic/setenv.c (free_mem): New function. Free all
allocated memory.

Expand Down
231 changes: 107 additions & 124 deletions configure

Large diffs are not rendered by default.

13 changes: 0 additions & 13 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,6 @@ yes) AC_MSG_ERROR(--with-gmp requires an argument; use --with-gmp=DIRECTORY) ;;
gmp-srcdir = $withval" ;;
esac
])
# Check for a --with-gettext argument and set gettext-srcdir in config.make.
AC_ARG_WITH(gettext, dnl
--with-gettext=DIR find GNU gettext source code in DIR (not needed),
[dnl
case "$with_gettext" in
yes)
AC_MSG_ERROR(--with-gettext requires an argument; use --with-gettext=DIR) ;;
''|no) ;;
*)
config_vars="$config_vars
gettext-srcdir = $withval" ;;
esac
])
# Check for a --with-gd argument and set libgd-LDFLAGS in config.make.
AC_ARG_WITH(gd, dnl
--with-gd=DIR find libgd include dir and library with prefix DIR,
Expand Down
10 changes: 6 additions & 4 deletions elf/dl-reloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],

/* If DT_BIND_NOW is set relocate all references in this object. We
do not do this if we are profiling, of course. */
if (!consider_profiling && l->l_info[DT_BIND_NOW])
if (!consider_profiling
&& __builtin_expect (l->l_info[DT_BIND_NOW] != NULL, 0))
lazy = 0;

if (__builtin_expect (_dl_debug_reloc, 0))
Expand All @@ -57,8 +58,8 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
caddr_t mapend = ((caddr_t) l->l_addr +
((ph->p_vaddr + ph->p_memsz + _dl_pagesize - 1)
& ~(_dl_pagesize - 1)));
if (__mprotect (mapstart, mapend - mapstart,
PROT_READ|PROT_WRITE) < 0)
if (__builtin_expect (__mprotect (mapstart, mapend - mapstart,
PROT_READ|PROT_WRITE), 0) < 0)
_dl_signal_error (errno, l->l_name, N_("\
cannot make segment writable for relocation"));
}
Expand Down Expand Up @@ -145,7 +146,8 @@ cannot make segment writable for relocation"));
prot |= PROT_EXEC;
}

if (__mprotect (mapstart, mapend - mapstart, prot) < 0)
if (__builtin_expect (__mprotect (mapstart, mapend - mapstart,
prot), 0) < 0)
_dl_signal_error (errno, l->l_name,
N_("can't restore segment prot after reloc"));

Expand Down
31 changes: 5 additions & 26 deletions intl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,13 @@ ifeq (no,$(cross-compiling))
ifeq (yes,$(build-shared))
ifneq ($(strip $(MSGFMT)),:)
.PHONY: do-gettext-test do-translit-test
tests: do-gettext-test do-translit-test
tests: $(objpfx)mtrace-tst-gettext do-translit-test
$(objpfx)mtrace-tst-gettext: do-gettext-test
$(common-objpfx)malloc/mtrace $(objpfx)tst-gettext.mtrace > $@
do-gettext-test: $(objpfx)tst-gettext.out
$(objpfx)tst-gettext.out: tst-gettext.sh $(objpfx)tst-gettext
$(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/
$(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/ \
$(objpfx)tst-gettext.mtrace
do-translit-test: $(objpfx)tst-translit.out
$(objpfx)tst-translit.out: tst-translit.sh $(objpfx)tst-translit
$(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/
Expand All @@ -76,27 +79,3 @@ YFLAGS = --name-prefix=__gettext --output

$(inst_msgcatdir)/locale.alias: locale.alias $(+force)
$(do-install)

ifdef gettext-srcdir

%.h:: ../gpl2lgpl.sed $(gettext-srcdir)/intl/%.glibc; $(copysrc)
%.c:: ../gpl2lgpl.sed $(gettext-srcdir)/intl/%.c; $(copysrc)
%.h:: ../gpl2lgpl.sed $(gettext-srcdir)/intl/%.h; $(copysrc)
locale.alias:: ../gpl2lgpl.sed $(gettext-srcdir)/misc/locale.alias; $(copysrc)

ifeq ($(with-cvs),yes)
define copysrc
sed -f $^ > $@.new
chmod a-w $@.new
mv -f $@.new $@
test ! -d CVS || cvs $(CVSOPTS) commit -m'Updated from $<' $@
endef
else
define copysrc
sed -f $^ > $@.new
chmod a-w $@.new
mv -f $@.new $@
endef
endif

endif
14 changes: 8 additions & 6 deletions intl/dcigettext.c
Original file line number Diff line number Diff line change
Expand Up @@ -1129,16 +1129,17 @@ mempcpy (dest, src, n)
static void __attribute__ ((unused))
free_mem (void)
{
struct binding *runp;
void *old;

for (runp = _nl_domain_bindings; runp != NULL; runp = runp->next)
while (_nl_domain_bindings != NULL)
{
if (runp->dirname != _nl_default_dirname)
struct binding *oldp = _nl_domain_bindings;
_nl_domain_bindings = _nl_domain_bindings->next;
if (oldp->dirname != _nl_default_dirname)
/* Yes, this is a pointer comparison. */
free (runp->dirname);
if (runp->codeset != NULL)
free (runp->codeset);
free (oldp->dirname);
free (oldp->codeset);
free (oldp);
}

if (_nl_current_default_domain != _nl_default_default_domain)
Expand All @@ -1147,6 +1148,7 @@ free_mem (void)

/* Remove the search tree with the known translations. */
__tdestroy (root, free);
root = NULL;

while (transmem_list != NULL)
{
Expand Down
4 changes: 4 additions & 0 deletions intl/tst-gettext.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include <libintl.h>
#include <locale.h>
#include <mcheck.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -55,6 +56,9 @@ main (int argc, char *argv[])
{
int result = 0;

/* For debugging. */
mtrace ();

/* This is the place where the .mo files are placed. */
if (argc > 1)
{
Expand Down
2 changes: 2 additions & 0 deletions intl/tst-gettext.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

common_objpfx=$1
objpfx=$2
malloc_trace=$3

GCONV_PATH=${common_objpfx}iconvdata
export GCONV_PATH
Expand All @@ -42,6 +43,7 @@ msgfmt -o ${objpfx}domaindir/existing-locale/LC_TIME/existing-time-domain.mo \
../po/de.po

# Now run the test.
MALLOC_TRACE=$malloc_trace \
${common_objpfx}elf/ld.so --library-path $common_objpfx \
${objpfx}tst-gettext > ${objpfx}tst-gettext.out ${objpfx}domaindir

Expand Down

0 comments on commit 55e2d5c

Please sign in to comment.