Просмотр исходного кода

libdpkg: Rename illegal_packagename to pkg_name_is_illegal

Guillem Jover лет назад: 15
Родитель
Сommit
f74dfc666e
8 измененных файлов с 19 добавлено и 12 удалено
  1. 1 1
      lib/dpkg/dpkg-db.h
  2. 5 3
      lib/dpkg/fields.c
  3. 1 1
      lib/dpkg/libdpkg.Versions
  4. 3 1
      lib/dpkg/parsehelp.c
  5. 6 3
      lib/dpkg/triglib.c
  6. 1 1
      src/main.c
  7. 1 1
      src/select.c
  8. 1 1
      src/trigcmd.c

+ 1 - 1
lib/dpkg/dpkg-db.h

@@ -241,7 +241,7 @@ enum parsedbflags {
   pdb_lax_parser        =040,
 };
 
-const char *illegal_packagename(const char *p, const char **ep);
+const char *pkg_name_is_illegal(const char *p, const char **ep);
 int parsedb(const char *filename, enum parsedbflags, struct pkginfo **donep,
             FILE *warnto, int *warncount);
 void copy_dependency_links(struct pkginfo *pkg,

+ 5 - 3
lib/dpkg/fields.c

@@ -71,7 +71,9 @@ f_name(struct pkginfo *pigp, struct pkginfoperfile *pifp,
        const char *value, const struct fieldinfo *fip)
 {
   const char *e;
-  if ((e= illegal_packagename(value,NULL)) != NULL)
+
+  e = pkg_name_is_illegal(value, NULL);
+  if (e != NULL)
     parse_error(ps, pigp, _("invalid package name (%.250s)"), e);
   /* We use the new name, as pkg_db_find() may have done a tolower for us. */
   pigp->name = pkg_db_find(value)->name;
@@ -322,7 +324,7 @@ void f_dependency(struct pkginfo *pigp, struct pkginfoperfile *pifp,
         parse_error(ps, pigp,
                     _("`%s' field, missing package name, or garbage where "
                       "package name expected"), fip->name);
-      emsg = illegal_packagename(depname.buf, NULL);
+      emsg = pkg_name_is_illegal(depname.buf, NULL);
       if (emsg)
         parse_error(ps, pigp,
                     _("`%s' field, invalid package name `%.255s': %s"),
@@ -517,7 +519,7 @@ f_trigaw(struct pkginfo *aw, struct pkginfoperfile *pifp,
                   "this context"));
 
   while ((word = scan_word(&value))) {
-    emsg = illegal_packagename(word, NULL);
+    emsg = pkg_name_is_illegal(word, NULL);
     if (emsg)
       parse_error(ps, aw,
                   _("illegal package name in awaited trigger `%.255s': %s"),

+ 1 - 1
lib/dpkg/libdpkg.Versions

@@ -165,7 +165,7 @@ LIBDPKG_PRIVATE {
 	# Package struct handling
 	blankpackage;
 	blankpackageperfile;
-	illegal_packagename;
+	pkg_name_is_illegal;
 	informative;
 	copy_dependency_links;
 	pkg_sorter_by_name;

+ 3 - 1
lib/dpkg/parsehelp.c

@@ -127,7 +127,9 @@ const struct namevalue wantinfos[] = {
   { .name = NULL }
 };
 
-const char *illegal_packagename(const char *p, const char **ep) {
+const char *
+pkg_name_is_illegal(const char *p, const char **ep)
+{
   static const char alsoallowed[]= "-+._"; /* _ is deprecated */
   static char buf[150];
   int c;

+ 6 - 3
lib/dpkg/triglib.c

@@ -272,7 +272,7 @@ trig_classify_byname(const char *name)
 		return &tki_file;
 	}
 
-	if (!illegal_packagename(name, NULL) && !strchr(name, '_'))
+	if (!pkg_name_is_illegal(name, NULL) && !strchr(name, '_'))
 		return &tki_explicit;
 
 invalid:
@@ -386,7 +386,8 @@ trk_explicit_activate_awaiter(struct pkginfo *aw)
 		        trk_explicit_fn.buf);
 
 	while (trk_explicit_fgets(buf, sizeof(buf)) >= 0) {
-		if ((emsg = illegal_packagename(buf, NULL)))
+		emsg = pkg_name_is_illegal(buf, NULL);
+		if (emsg)
 			ohshit(_("trigger interest file `%.250s' syntax error; "
 			         "illegal package name `%.250s': %.250s"),
 			       trk_explicit_fn.buf, buf, emsg);
@@ -580,7 +581,9 @@ trig_file_interests_ensure(void)
 			ohshit(_("syntax error in file triggers file `%.250s'"),
 			       triggersfilefile);
 		*space++ = '\0';
-		if ((emsg = illegal_packagename(space, NULL)))
+
+		emsg = pkg_name_is_illegal(space, NULL);
+		if (emsg)
 			ohshit(_("file triggers record mentions illegal "
 			         "package name `%.250s' (for interest in file "
 				 "`%.250s'): %.250s"), space, linebuf, emsg);

+ 1 - 1
src/main.c

@@ -281,7 +281,7 @@ static void ignoredepends(const struct cmdinfo *cip, const char *value) {
   }
   p= copy;
   while (*p) {
-    pnerr = illegal_packagename(p, NULL);
+    pnerr = pkg_name_is_illegal(p, NULL);
     if (pnerr) ohshite(_("--ignore-depends requires a legal package name. "
                        "`%.250s' is not; %s"), p, pnerr);
 

+ 1 - 1
src/select.c

@@ -125,7 +125,7 @@ void setselections(const char *const *argv) {
     }
     varbufaddc(&namevb,0);
     varbufaddc(&selvb,0);
-    e = illegal_packagename(namevb.buf, NULL);
+    e = pkg_name_is_illegal(namevb.buf, NULL);
     if (e) ohshit(_("illegal package name at line %d: %.250s"),lno,e);
     for (nvp=wantinfos; nvp->name && strcmp(nvp->name,selvb.buf); nvp++);
     if (!nvp->name) ohshit(_("unknown wanted status at line %d: %.250s"),lno,selvb.buf);

+ 1 - 1
src/trigcmd.c

@@ -210,7 +210,7 @@ main(int argc, const char *const *argv)
 			         " (or with a --by-package option)"));
 	}
 	if (strcmp(bypackage, "-") &&
-	    (badname = illegal_packagename(bypackage, NULL)))
+	    (badname = pkg_name_is_illegal(bypackage, NULL)))
 		ohshit(_("illegal awaited package name '%.250s': %.250s"),
 		       bypackage, badname);