Kaynağa Gözat

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 yıl önce
ebeveyn
işleme
931d9ade22
4 değiştirilmiş dosya ile 2 ekleme ve 14 silme
  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();
   itd_description();
 
 
-  whatinfovb.terminate();
   int y,x;
   int y,x;
   getyx(infopad, y,x);
   getyx(infopad, y,x);
   if (x) y++;
   if (x) y++;

+ 1 - 3
dselect/pkginfo.cc

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

+ 1 - 9
lib/dpkg/varbuf.h

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