Hi all, I noticed some rather strange code in _dl_malloc, and was wondering whether this patch might be appropriate.
It looks like the code is intended to do an alignment, but the use of & would appear to be equivalent to an assignment. >From 6bd671f8248ede388f1765d3af5f784b780b5c9e Mon Sep 17 00:00:00 2001 From: Will Newton <[email protected]> Date: Tue, 3 Nov 2009 15:57:29 +0000 Subject: [PATCH] ldso/ldso/ldso.c: Improve code readability in _dl_malloc. The rounding of the allocation to the page size is written in a rather strange manner. Signed-off-by: Will Newton <[email protected]> --- ldso/ldso/ldso.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index 021f109..9ab9a2f 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -187,7 +187,7 @@ void *_dl_malloc(size_t size) The actual page size doesn't really matter; as long as we're self-consistent here, we're safe. */ if (size < _dl_pagesize) - rounded_size = (size + ADDR_ALIGN) & _dl_pagesize; + rounded_size = _dl_pagesize; else rounded_size = size; -- 1.5.5.2
From 6bd671f8248ede388f1765d3af5f784b780b5c9e Mon Sep 17 00:00:00 2001 From: Will Newton <[email protected]> Date: Tue, 3 Nov 2009 15:57:29 +0000 Subject: [PATCH] ldso/ldso/ldso.c: Improve code readability in _dl_malloc. The rounding of the allocation to the page size is written in a rather strange manner. Signed-off-by: Will Newton <[email protected]> --- ldso/ldso/ldso.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index 021f109..9ab9a2f 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -187,7 +187,7 @@ void *_dl_malloc(size_t size) The actual page size doesn't really matter; as long as we're self-consistent here, we're safe. */ if (size < _dl_pagesize) - rounded_size = (size + ADDR_ALIGN) & _dl_pagesize; + rounded_size = _dl_pagesize; else rounded_size = size; -- 1.5.5.2
_______________________________________________ uClibc mailing list [email protected] http://lists.busybox.net/mailman/listinfo/uclibc
