mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-03 09:46:17 +01:00
gdb: Fix GHashTable pretty printer off-by-one error
Commit 7678b107
seems to have left the GHashTable pretty printer with an
off-by-one error, skipping the first key it encounters and printing an
extra garbage key/value pair instead. This fixes that by moving an
increment to the end of a loop rather than the beginning.
This commit is contained in:
parent
e83c8abd2f
commit
9042326ffc
@ -124,7 +124,6 @@ class GHashPrinter:
|
|||||||
self.value = None
|
self.value = None
|
||||||
return v
|
return v
|
||||||
while long(self.pos) < long(self.size):
|
while long(self.pos) < long(self.size):
|
||||||
self.pos = self.pos + 1
|
|
||||||
if long (self.hashes[self.pos]) >= 2:
|
if long (self.hashes[self.pos]) >= 2:
|
||||||
key = self.keys[self.pos]
|
key = self.keys[self.pos]
|
||||||
val = self.values[self.pos]
|
val = self.values[self.pos]
|
||||||
@ -135,8 +134,12 @@ class GHashPrinter:
|
|||||||
# Queue value for next result
|
# Queue value for next result
|
||||||
self.value = ('[%dv]'% (self.pos), val)
|
self.value = ('[%dv]'% (self.pos), val)
|
||||||
|
|
||||||
# Return key
|
# Increment pos and return key
|
||||||
return ('[%dk]'% (self.pos), key)
|
key = ('[%dk]'% (self.pos), key)
|
||||||
|
self.pos += 1
|
||||||
|
return key
|
||||||
|
|
||||||
|
self.pos += 1
|
||||||
raise StopIteration
|
raise StopIteration
|
||||||
|
|
||||||
__next__ = next
|
__next__ = next
|
||||||
|
Loading…
Reference in New Issue
Block a user