1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

Avoid memset warning in one case.

This commit is contained in:
Caolan McNamara
2009-11-10 06:29:13 -08:00
committed by Ulrich Drepper
parent 639d6699e9
commit 6515a01fc1
2 changed files with 8 additions and 2 deletions

View File

@ -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
@ -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;