The following commit has been merged in the master branch:
commit 7d01220ed0fb2f9ae647049b37bea77718fc0612
Author: Guillem Jover <[email protected]>
Date:   Mon Sep 10 11:47:38 2012 +0200

    dselect: Use str_is_unset() instead of ad-hoc checks

diff --git a/dselect/methlist.cc b/dselect/methlist.cc
index 5b92836..4281d55 100644
--- a/dselect/methlist.cc
+++ b/dselect/methlist.cc
@@ -30,6 +30,7 @@
 #include <dpkg/i18n.h>
 #include <dpkg/dpkg.h>
 #include <dpkg/dpkg-db.h>
+#include <dpkg/string.h>
 
 #include "dselect.h"
 #include "bindings.h"
@@ -189,7 +190,8 @@ void methodlist::itd_description() {
   wattrset(infopad, part_attr[info]);
 
   const char *m= table[cursorline]->description;
-  if (!m || !*m) m= _("No explanation available.");
+  if (str_is_unset(m))
+    m = _("No explanation available.");
   waddstr(infopad,"\n\n");
   wordwrapinfo(0,m);
 }
diff --git a/dselect/pkginfo.cc b/dselect/pkginfo.cc
index 1ab79f5..2e167b9 100644
--- a/dselect/pkginfo.cc
+++ b/dselect/pkginfo.cc
@@ -28,6 +28,7 @@
 #include <dpkg/i18n.h>
 #include <dpkg/dpkg.h>
 #include <dpkg/dpkg-db.h>
+#include <dpkg/string.h>
 
 #include "dselect.h"
 #include "bindings.h"
@@ -106,9 +107,9 @@ void packagelist::itd_description() {
 
   if (table[cursorline]->pkg->set->name) {
     const char *m= table[cursorline]->pkg->available.description;
-    if (!m || !*m)
+    if (str_is_unset(m))
       m = table[cursorline]->pkg->installed.description;
-    if (!m || !*m)
+    if (str_is_unset(m))
       m = _("No description available.");
     const char *p= strchr(m,'\n');
     int l= p ? (int)(p-m) : strlen(m);
diff --git a/dselect/pkglist.cc b/dselect/pkglist.cc
index 200d6e2..e92564c 100644
--- a/dselect/pkglist.cc
+++ b/dselect/pkglist.cc
@@ -31,6 +31,7 @@
 #include <dpkg/i18n.h>
 #include <dpkg/dpkg.h>
 #include <dpkg/dpkg-db.h>
+#include <dpkg/string.h>
 
 #include "dselect.h"
 #include "bindings.h"
@@ -492,7 +493,7 @@ packagelist::checksearch(char *rx)
 {
   int r,opt = REG_NOSUB;
 
-  if (!rx || !*rx)
+  if (str_is_unset(rx))
     return false;
 
   searchdescr=0;
@@ -544,7 +545,7 @@ packagelist::matchsearch(int index)
 
   if (searchdescr) {
     const char *descr = table[index]->pkg->available.description;
-    if (!descr || !*descr)
+    if (str_is_unset(descr))
       return false;
 
     if (regexec(&searchfsm, descr, 0, NULL, 0)==0)

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to