projects
/
platform
/
upstream
/
bcc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d1a0e7f
)
Add a table.zero() function to bcc.TableBase
author
Brenden Blanco
<bblanco@plumgrid.com>
Tue, 23 Feb 2016 21:10:50 +0000
(13:10 -0800)
committer
Brenden Blanco
<bblanco@plumgrid.com>
Tue, 23 Feb 2016 21:10:50 +0000
(13:10 -0800)
It is sometimes useful to zero out the entries of table without erasing
the keys. Add a zero() function to make this easy.
Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
src/python/bcc/table.py
patch
|
blob
|
history
diff --git
a/src/python/bcc/table.py
b/src/python/bcc/table.py
index
a364e32
..
26fa868
100644
(file)
--- a/
src/python/bcc/table.py
+++ b/
src/python/bcc/table.py
@@
-186,6
+186,10
@@
class TableBase(MutableMapping):
for k in self.keys():
self.__delitem__(k)
+ def zero(self):
+ for k in self.keys():
+ self[k] = self.Leaf()
+
def __iter__(self):
return TableBase.Iter(self, self.Key)