summaryrefslogtreecommitdiff
path: root/python/cache.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2009-07-24 20:49:39 +0200
committerJulian Andres Klode <jak@debian.org>2009-07-24 20:49:39 +0200
commitdb27b9d050c466eabf6eb72899bfbe696af8852b (patch)
tree0a1e56c1fdddbe6c47530e033a282e8da54b1a3e /python/cache.cc
parentfda01b9ec100db7d2e5f7434edadd1fe84d4fdee (diff)
downloadpython-apt-db27b9d050c466eabf6eb72899bfbe696af8852b.tar.gz
python: Fix some more possible NULL issues.
Diffstat (limited to 'python/cache.cc')
-rw-r--r--python/cache.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/python/cache.cc b/python/cache.cc
index 30c0e683..68ee7b9e 100644
--- a/python/cache.cc
+++ b/python/cache.cc
@@ -840,6 +840,7 @@ static PyObject *VersionGetIsTrusted(PyObject *Self, void*) {
}
#endif
+#define NOTNULL(x) (x ? x : "")
static PyObject *VersionRepr(PyObject *Self)
{
@@ -848,11 +849,12 @@ static PyObject *VersionRepr(PyObject *Self)
" Arch:'%s' Size:%lu ISize:%lu Hash:%u ID:%u "
"Priority:%u>", Self->ob_type->tp_name,
Ver.ParentPkg().Name(), Ver.VerStr(),
- Ver.Section(), Ver.Arch(),
+ NOTNULL(Ver.Section()), NOTNULL(Ver.Arch()),
(unsigned long)Ver->Size,
(unsigned long)Ver->InstalledSize,
Ver->Hash, Ver->ID, Ver->Priority);
}
+#undef NOTNULL
static PyGetSetDef VersionGetSet[] = {
{"arch",VersionGetArch},
@@ -1096,7 +1098,7 @@ static PyObject *DependencyRepr(PyObject *Self)
return PyString_FromFormat("<%s object: pkg:'%s' ver:'%s' comp:'%s'>",
Self->ob_type->tp_name, Dep.TargetPkg().Name(),
- (Dep.TargetVer() == 0?"":Dep.TargetVer()),
+ (Dep.TargetVer() == 0 ? "" : Dep.TargetVer()),
Dep.CompType());
}