Skip to content

Commit 62e2baa

Browse files
committed
warning: returning reference to temporary
1 parent 04b1b61 commit 62e2baa

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/base/judy/src/judyL2Array.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class judyL2Array {
4141
vector ** _lastSlot;
4242
JudyKey _buff[1];
4343
bool _success;
44+
cpair kv;
4445
public:
4546
judyL2Array(): _maxLevels( sizeof( JudyKey ) ), _depth( 1 ), _lastSlot( 0 ), _success( true ) {
4647
assert( sizeof( JudyKey ) == JUDY_key_size && "JudyKey *must* be the same size as a pointer!" );
@@ -159,8 +160,7 @@ class judyL2Array {
159160
}
160161

161162
/// retrieve the key-value pair for the most recent judy query.
162-
inline const cpair mostRecentPair() {
163-
cpair kv;
163+
inline const cpair & mostRecentPair() {
164164
judy_key( _judyarray, ( unsigned char * ) _buff, _depth * JUDY_key_size );
165165
if( _lastSlot ) {
166166
kv.value = *_lastSlot;

src/base/judy/src/judyS2Array.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class judyS2Array {
4040
vector ** _lastSlot;
4141
unsigned char * _buff;
4242
bool _success;
43+
cpair kv;
4344
public:
4445
judyS2Array( unsigned int maxKeyLen ): _maxKeyLen( maxKeyLen ), _lastSlot( 0 ), _success( true ) {
4546
_judyarray = judy_open( _maxKeyLen, 0 );
@@ -184,8 +185,7 @@ class judyS2Array {
184185
}
185186

186187
/// retrieve the key-value pair for the most recent judy query.
187-
inline const cpair mostRecentPair() {
188-
cpair kv;
188+
inline const cpair & mostRecentPair() {
189189
judy_key( _judyarray, _buff, _maxKeyLen );
190190
if( _lastSlot ) {
191191
kv.value = *_lastSlot;

0 commit comments

Comments
 (0)