From aa5ccd998087e757ebbf21a332749d45ccc18b1c Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Mon, 22 Jan 2007 15:19:40 +0000 Subject: [PATCH] stl_algobase.h (__fill_aux(unsigned char*, unsigned char*, const unsigned char&), [...]): Take the character by value. 2007-01-22 Paolo Carlini * include/bits/stl_algobase.h (__fill_aux(unsigned char*, unsigned char*, const unsigned char&), __fill_aux(signed char*, signed char*, const signed char&), __fill_aux(char*, char*, const char&), __fill_aux(wchar_t*, wchar_t*, const wchar_t&)): Take the character by value. (__fill_n_aux): Likewise. From-SVN: r121056 --- libstdc++-v3/ChangeLog | 9 ++++++ libstdc++-v3/include/bits/stl_algobase.h | 38 ++++++++---------------- 2 files changed, 21 insertions(+), 26 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 80b49e1c209..8cf4f9287a8 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,12 @@ +2007-01-22 Paolo Carlini + + * include/bits/stl_algobase.h (__fill_aux(unsigned char*, + unsigned char*, const unsigned char&), __fill_aux(signed char*, + signed char*, const signed char&), __fill_aux(char*, char*, + const char&), __fill_aux(wchar_t*, wchar_t*, const wchar_t&)): + Take the character by value. + (__fill_n_aux): Likewise. + 2007-01-21 Paolo Carlini PR libstdc++/30449 (fill, fill_n) diff --git a/libstdc++-v3/include/bits/stl_algobase.h b/libstdc++-v3/include/bits/stl_algobase.h index c0107fc3d9f..c24a4f8d839 100644 --- a/libstdc++-v3/include/bits/stl_algobase.h +++ b/libstdc++-v3/include/bits/stl_algobase.h @@ -580,35 +580,21 @@ _GLIBCXX_BEGIN_NAMESPACE(std) // Specialization: for char types we can use memset (wmemset). inline void - __fill_aux(unsigned char* __first, unsigned char* __last, - const unsigned char& __c) - { - const unsigned char __tmp = __c; - std::memset(__first, __tmp, __last - __first); - } + __fill_aux(unsigned char* __first, unsigned char* __last, unsigned char __c) + { std::memset(__first, __c, __last - __first); } inline void - __fill_aux(signed char* __first, signed char* __last, - const signed char& __c) - { - const signed char __tmp = __c; - std::memset(__first, static_cast(__tmp), __last - __first); - } + __fill_aux(signed char* __first, signed char* __last, signed char __c) + { std::memset(__first, static_cast(__c), __last - __first); } inline void - __fill_aux(char* __first, char* __last, const char& __c) - { - const char __tmp = __c; - std::memset(__first, static_cast(__tmp), __last - __first); - } + __fill_aux(char* __first, char* __last, char __c) + { std::memset(__first, static_cast(__c), __last - __first); } #ifdef _GLIBCXX_USE_WCHAR_T inline void - __fill_aux(wchar_t* __first, wchar_t* __last, const wchar_t& __c) - { - const wchar_t __tmp = __c; - std::wmemset(__first, __tmp, __last - __first); - } + __fill_aux(wchar_t* __first, wchar_t* __last, wchar_t __c) + { std::wmemset(__first, __c, __last - __first); } #endif template @@ -693,7 +679,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) template inline unsigned char* - __fill_n_aux(unsigned char* __first, _Size __n, const unsigned char& __c) + __fill_n_aux(unsigned char* __first, _Size __n, unsigned char __c) { std::__fill_aux(__first, __first + __n, __c); return __first + __n; @@ -701,7 +687,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) template inline signed char* - __fill_n_aux(signed char* __first, _Size __n, const signed char& __c) + __fill_n_aux(signed char* __first, _Size __n, signed char __c) { std::__fill_aux(__first, __first + __n, __c); return __first + __n; @@ -709,7 +695,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) template inline char* - __fill_n_aux(char* __first, _Size __n, const char& __c) + __fill_n_aux(char* __first, _Size __n, char __c) { std::__fill_aux(__first, __first + __n, __c); return __first + __n; @@ -718,7 +704,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) #ifdef _GLIBCXX_USE_WCHAR_T template inline wchar_t* - __fill_n_aux(wchar_t* __first, _Size __n, const wchar_t& __c) + __fill_n_aux(wchar_t* __first, _Size __n, wchar_t __c) { std::__fill_aux(__first, __first + __n, __c); return __first + __n; -- 2.30.2