This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Extraneous assertions
- To: libc-alpha at sources dot redhat dot com
- Subject: Extraneous assertions
- From: Bruno Haible <haible at ilog dot fr>
- Date: Fri, 1 Sep 2000 13:59:40 +0200 (CEST)
Here is a patch to
- remove redundant assertions,
- add in strxfrm.c the same assertions as in strcoll.c.
2000-08-31 Bruno Haible <haible@clisp.cons.org>
* locale/programs/ld-collate.c (collate_output): Remove redundant
assert call.
* string/strcoll.c: Likewise.
* string/strxfrm.c: Include assert.h. Add assert calls like in
string/strcoll.c.
*** glibc-20000831/locale/programs/ld-collate.c.bak Thu Aug 31 13:15:23 2000
--- glibc-20000831/locale/programs/ld-collate.c Fri Sep 1 01:45:03 2000
***************
*** 2439,2445 ****
iov[2 + cnt].iov_base = obstack_finish (&extrapool);
idx[1 + cnt] = idx[cnt] + iov[2 + cnt].iov_len;
assert (iov[2 + cnt].iov_len % sizeof (int32_t) == 0);
- assert (iov[2 + cnt].iov_len % sizeof (int32_t) == 0);
assert (idx[cnt] % 4 == 0);
++cnt;
--- 2372,2377 ----
*** glibc-20000831/string/strcoll.c.bak Thu Aug 31 01:55:04 2000
--- glibc-20000831/string/strcoll.c Fri Sep 1 01:32:29 2000
***************
*** 129,135 ****
assert (((uintptr_t) table) % sizeof (table[0]) == 0);
assert (((uintptr_t) weights) % sizeof (weights[0]) == 0);
- assert (((uintptr_t) weights) % sizeof (weights[0]) == 0);
assert (((uintptr_t) extra) % sizeof (extra[0]) == 0);
assert (((uintptr_t) indirect) % sizeof (indirect[0]) == 0);
--- 129,134 ----
*** glibc-20000831/string/strxfrm.c.bak Thu Aug 31 01:55:04 2000
--- glibc-20000831/string/strxfrm.c Fri Sep 1 01:55:29 2000
***************
*** 17,22 ****
--- 17,23 ----
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+ #include <assert.h>
#include <langinfo.h>
#include <stddef.h>
#include <stdint.h>
***************
*** 149,154 ****
--- 150,160 ----
_NL_CURRENT (LC_COLLATE, CONCAT(_NL_COLLATE_INDIRECT,SUFFIX));
#endif
use_malloc = 0;
+
+ assert (((uintptr_t) table) % sizeof (table[0]) == 0);
+ assert (((uintptr_t) weights) % sizeof (weights[0]) == 0);
+ assert (((uintptr_t) extra) % sizeof (extra[0]) == 0);
+ assert (((uintptr_t) indirect) % sizeof (indirect[0]) == 0);
/* Handle an empty string as a special case. */
if (srclen == 0)