[glib/glib-2-62: 1/2] gdb: Fix GHashTable pretty printer off-by-one error
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/glib-2-62: 1/2] gdb: Fix GHashTable pretty printer off-by-one error
- Date: Mon, 18 Nov 2019 12:48:03 +0000 (UTC)
commit 7f52ce187ff0c554fc24f64fdf3a85a2fafaf218
Author: Philip Chimento <philip endlessm com>
Date: Tue Nov 5 14:28:41 2019 -0800
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.
glib/glib_gdb.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/glib/glib_gdb.py b/glib/glib_gdb.py
index 37d01cb76..fd8baf58c 100644
--- a/glib/glib_gdb.py
+++ b/glib/glib_gdb.py
@@ -124,7 +124,6 @@ class GHashPrinter:
self.value = None
return v
while long(self.pos) < long(self.size):
- self.pos = self.pos + 1
if long (self.hashes[self.pos]) >= 2:
key = self.keys[self.pos]
val = self.values[self.pos]
@@ -135,8 +134,12 @@ class GHashPrinter:
# Queue value for next result
self.value = ('[%dv]'% (self.pos), val)
- # Return key
- return ('[%dk]'% (self.pos), key)
+ # Increment pos and return key
+ key = ('[%dk]'% (self.pos), key)
+ self.pos += 1
+ return key
+
+ self.pos += 1
raise StopIteration
__next__ = next
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]