Przeglądaj źródła

libdpkg: Remove varbuf terminate() method

The string() method already NUL terminates the buffer, so there is never
any need to explicitly terminate it beforehand.
Guillem Jover 10 lat temu
rodzic
commit
931d9ade22
4 zmienionych plików z 2 dodań i 14 usunięć
  1. 0 1
      dselect/methlist.cc
  2. 1 3
      dselect/pkginfo.cc
  3. 0 1
      dselect/pkgsublist.cc
  4. 1 9
      lib/dpkg/varbuf.h

+ 0 - 1
dselect/methlist.cc

@@ -206,7 +206,6 @@ void methodlist::redrawinfo() {
 
   itd_description();
 
-  whatinfovb.terminate();
   int y,x;
   getyx(infopad, y,x);
   if (x) y++;

+ 1 - 3
dselect/pkginfo.cc

@@ -139,7 +139,6 @@ void packagelist::itd_statuscontrol() {
   } else {
     varbuf vb;
     varbufrecord(&vb,table[cursorline]->pkg,&table[cursorline]->pkg->installed);
-    vb.terminate();
     debug(dbg_general, "packagelist[%p]::idt_statuscontrol(); '%s'",
           this, vb.string());
     waddstr(infopad,vb.string());
@@ -155,7 +154,6 @@ void packagelist::itd_availablecontrol() {
   } else {
     varbuf vb;
     varbufrecord(&vb,table[cursorline]->pkg,&table[cursorline]->pkg->available);
-    vb.terminate();
     debug(dbg_general, "packagelist[%p]::idt_availablecontrol(); '%s'",
           this, vb.string());
     waddstr(infopad,vb.string());
@@ -177,7 +175,7 @@ void packagelist::redrawinfo() {
         this, (int)(currentinfo - baseinfo));
 
   (this->*currentinfo->display)();
-  whatinfovb.terminate();
+
   int y,x;
   getyx(infopad, y,x);
   if (x) y++;

+ 0 - 1
dselect/pkgsublist.cc

@@ -76,7 +76,6 @@ void packagelist::add(pkginfo *pkg, const char *extrainfo, showpriority showimp)
   add(pkg);  if (!pkg->clientdata) return;
   if (pkg->clientdata->dpriority < showimp) pkg->clientdata->dpriority= showimp;
   pkg->clientdata->relations(extrainfo);
-  pkg->clientdata->relations.terminate();
 }
 
 bool

+ 1 - 9
lib/dpkg/varbuf.h

@@ -64,7 +64,6 @@ struct varbuf {
 	void destroy();
 	void operator()(int c);
 	void operator()(const char *s);
-	void terminate(void/*to shut 2.6.3 up*/);
 	const char *string();
 #endif
 };
@@ -144,17 +143,10 @@ varbuf::operator()(const char *s)
 	varbuf_add_str(this, s);
 }
 
-inline void
-varbuf::terminate(void/*to shut 2.6.3 up*/)
-{
-	varbuf_end_str(this);
-}
-
 inline const char *
 varbuf::string()
 {
-	terminate();
-	return buf;
+	return varbuf_get_str(this);
 }
 #endif