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

libdpkg: Make trig argument in some functions const

And we can thus remove a bogus cast.
Guillem Jover лет назад: 17
Родитель
Сommit
d6a922fd1d
3 измененных файлов с 14 добавлено и 6 удалено
  1. 8 0
      ChangeLog
  2. 2 2
      lib/dpkg-db.h
  3. 4 4
      lib/triglib.c

+ 8 - 0
ChangeLog

@@ -1,3 +1,11 @@
+2009-01-04  Guillem Jover  <guillem@debian.org>
+
+	* lib/dpkg-db.h (trig_note_pend_core, trig_note_pend): Make trig
+	argument const.
+	* lib/triglib.c (trig_record_activation): Likewise.
+	(trig_file_activate): Remove now unneeded cast in
+	trig_record_activation call.
+
 2009-01-04  Guillem Jover  <guillem@debian.org>
 
 	* lib/myopt.h (MAX_CONFIG_LINE): New macro.

+ 2 - 2
lib/dpkg-db.h

@@ -293,8 +293,8 @@ extern struct trig_hooks trigh;
 void trig_file_activate_byname(const char *trig, struct pkginfo *aw);
 void trig_file_activate(struct filenamenode *trig, struct pkginfo *aw);
 
-int trig_note_pend_core(struct pkginfo *pend, char *trig /*not copied!*/);
-int trig_note_pend(struct pkginfo *pend, char *trig /*not copied!*/);
+int trig_note_pend_core(struct pkginfo *pend, const char *trig /*not copied!*/);
+int trig_note_pend(struct pkginfo *pend, const char *trig /*not copied!*/);
 int trig_note_aw(struct pkginfo *pend, struct pkginfo *aw);
 void trig_clear_awaiters(struct pkginfo *notpend);
 

+ 4 - 4
lib/triglib.c

@@ -75,7 +75,7 @@ illegal_triggername(const char *p)
 
 /* aw might be NULL, and trig is not copied! */
 static void
-trig_record_activation(struct pkginfo *pend, struct pkginfo *aw, char *trig)
+trig_record_activation(struct pkginfo *pend, struct pkginfo *aw, const char *trig)
 {
 	if (pend->status < stat_triggersawaited)
 		/* Not interested then. */
@@ -97,7 +97,7 @@ trig_record_activation(struct pkginfo *pend, struct pkginfo *aw, char *trig)
 
 /* NB that this is also called from fields.c where *pend is a temporary! */
 int
-trig_note_pend_core(struct pkginfo *pend, char *trig /*not copied!*/)
+trig_note_pend_core(struct pkginfo *pend, const char *trig /*not copied!*/)
 {
 	struct trigpend *tp;
 
@@ -115,7 +115,7 @@ trig_note_pend_core(struct pkginfo *pend, char *trig /*not copied!*/)
 
 /* Returns: 1 for done, 0 for already noted. */
 int
-trig_note_pend(struct pkginfo *pend, char *trig /*not copied!*/)
+trig_note_pend(struct pkginfo *pend, const char *trig /*not copied!*/)
 {
 	if (!trig_note_pend_core(pend, trig))
 		return 0;
@@ -566,7 +566,7 @@ trig_file_activate(struct filenamenode *trig, struct pkginfo *aw)
 
 	for (tfi = *trigh.namenode_interested(trig); tfi;
 	     tfi = tfi->samefile_next)
-		trig_record_activation(tfi->pkg, aw, (char*)trigh.namenode_name(trig));
+		trig_record_activation(tfi->pkg, aw, trigh.namenode_name(trig));
 }
 
 static void