summaryrefslogtreecommitdiff
path: root/sal/rtl
diff options
context:
space:
mode:
authorNoel <noelgrandin@gmail.com>2020-10-05 09:28:37 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-10-05 14:41:59 +0200
commit8ec183056dd7a954d9af7b26432d7680a31e9896 (patch)
tree5d6e9a7ee435f3e9fc50b9b34373de1722f0f68b /sal/rtl
parentb65d21596b5773d744b242716a78308d2c3714d0 (diff)
loplugin:reducevarscope in sal
Change-Id: I2ce95de07b8e0952a1e778e65940b30597396aa6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103949 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sal/rtl')
-rw-r--r--sal/rtl/byteseq.cxx7
-rw-r--r--sal/rtl/ustring.cxx4
2 files changed, 5 insertions, 6 deletions
diff --git a/sal/rtl/byteseq.cxx b/sal/rtl/byteseq.cxx
index c78a1e22f43a..3c4967d5456d 100644
--- a/sal/rtl/byteseq.cxx
+++ b/sal/rtl/byteseq.cxx
@@ -39,13 +39,14 @@ static sal_Sequence aEmpty_rtl_ByteSeq =
void SAL_CALL rtl_byte_sequence_reference2One(
sal_Sequence ** ppSequence ) SAL_THROW_EXTERN_C()
{
- sal_Sequence * pSequence, * pNew;
+ sal_Sequence * pSequence;
OSL_ENSURE( ppSequence, "### null ptr!" );
pSequence = *ppSequence;
if (pSequence->nRefCount > 1)
{
+ sal_Sequence *pNew;
sal_Int32 nElements = pSequence->nElements;
if (nElements)
{
@@ -75,7 +76,7 @@ void SAL_CALL rtl_byte_sequence_reference2One(
void SAL_CALL rtl_byte_sequence_realloc(
sal_Sequence ** ppSequence, sal_Int32 nSize ) SAL_THROW_EXTERN_C()
{
- sal_Sequence * pSequence, * pNew;
+ sal_Sequence * pSequence;
sal_Int32 nElements;
assert(ppSequence && "### null ptr!");
@@ -87,7 +88,7 @@ void SAL_CALL rtl_byte_sequence_realloc(
if (pSequence->nRefCount > 1) // split
{
- pNew = static_cast<sal_Sequence *>(malloc( SAL_SEQUENCE_HEADER_SIZE + nSize ));
+ sal_Sequence *pNew = static_cast<sal_Sequence *>(malloc( SAL_SEQUENCE_HEADER_SIZE + nSize ));
if ( pNew != nullptr )
{
diff --git a/sal/rtl/ustring.cxx b/sal/rtl/ustring.cxx
index cbadddc6a98e..7b6687f74bd5 100644
--- a/sal/rtl/ustring.cxx
+++ b/sal/rtl/ustring.cxx
@@ -1054,14 +1054,12 @@ void SAL_CALL rtl_uString_internConvert( rtl_uString ** newStr,
static void
internRelease (rtl_uString *pThis)
{
- oslMutex pPoolMutex;
-
rtl_uString *pFree = nullptr;
if ( SAL_STRING_REFCOUNT(
osl_atomic_decrement( &(pThis->refCount) ) ) == 0)
{
RTL_LOG_STRING_INTERN_DELETE(pThis);
- pPoolMutex = getInternMutex();
+ oslMutex pPoolMutex = getInternMutex();
osl_acquireMutex( pPoolMutex );
rtl_str_hash_remove (pThis);