Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Avoid memset warning in one case.
  • Loading branch information
Caolan McNamara authored and Ulrich Drepper committed Nov 10, 2009
1 parent 639d669 commit 6515a01
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
@@ -1,3 +1,8 @@
2009-11-10 Ulrich Drepper <drepper@redhat.com>

* string/bits/string3.h (memset): If the second parameter is constant
and zero there is likely no transposition.

2009-11-04 Philippe De Muyter <phdm@macqel.be>

* sysdeps/powerpc/fpu/e_sqrt.c: Fix spelling of (Newton-)Raphson.
Expand Down
5 changes: 3 additions & 2 deletions string/bits/string3.h
@@ -1,4 +1,4 @@
/* Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
/* Copyright (C) 2004, 2005, 2007, 2009 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
Expand Down Expand Up @@ -77,7 +77,8 @@ __NTH (mempcpy (void *__restrict __dest, __const void *__restrict __src,
__extern_always_inline void *
__NTH (memset (void *__dest, int __ch, size_t __len))
{
if (__builtin_constant_p (__len) && __len == 0)
if (__builtin_constant_p (__len) && __len == 0
&& (!__builtin_constant_p (__ch) || __ch != 0))
{
__warn_memset_zero_len ();
return __dest;
Expand Down

0 comments on commit 6515a01

Please sign in to comment.