[libgtop] Don't try to print a NULL hash_table.
- From: Robert Roth <robertroth src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgtop] Don't try to print a NULL hash_table.
- Date: Thu, 25 Jun 2015 23:59:32 +0000 (UTC)
commit e0244ad3fc81098cb339acaa98cbe9c1b23a6bf5
Author: Benoit Dejean <bdejean gmail com>
Date: Sun Jun 21 15:38:32 2015 +0200
Don't try to print a NULL hash_table.
examples/pprint.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/examples/pprint.c b/examples/pprint.c
index ae018ea..20a7e9a 100644
--- a/examples/pprint.c
+++ b/examples/pprint.c
@@ -43,9 +43,11 @@ printf("\t%4lu B %3lu " #ARRAY "[%lu] = { ", \
(unsigned long) sizeof buf->ARRAY, 0,\
(unsigned long) G_N_ELEMENTS(buf->ARRAY)); \
for(i = 0; i < SIZE; ++i) { \
-printf ("[ ");\
-PPRINT_HASHTABLE(buf->ARRAY[i].values); \
-printf ("]\n");\
+ if (buf->ARRAY[i].values) { \
+ printf ("[ "); \
+ PPRINT_HASHTABLE(buf->ARRAY[i].values); \
+ printf ("]\n"); \
+ } \
} \
printf("} "); \
} while(0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]