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

Remove unneeded static modifier from function variables

The cleanup functions do not need a static variable when it's a pointer
and we pass its value to it.
Guillem Jover лет назад: 16
Родитель
Сommit
e964abe1e4
4 измененных файлов с 5 добавлено и 5 удалено
  1. 1 1
      dpkg-deb/info.c
  2. 2 2
      src/main.c
  3. 1 1
      src/query.c
  4. 1 1
      src/statcmd.c

+ 1 - 1
dpkg-deb/info.c

@@ -67,7 +67,7 @@ static void info_prepare(const char *const **argvp,
                          const char **debarp,
                          const char **directoryp,
                          int admininfo) {
-  static char *dbuf;
+  char *dbuf;
   pid_t c1;
   
   *debarp= *(*argvp)++;

+ 2 - 2
src/main.c

@@ -601,7 +601,7 @@ void commandfd(const char *const *argv) {
   FILE *in;
   unsigned long infd;
   int c, lno, i, skipchar;
-  static void (*actionfunction)(const char *const *argv);
+  void (*actionfunction)(const char *const *argv);
 
   pipein = *argv++;
   if (pipein == NULL)
@@ -693,7 +693,7 @@ void commandfd(const char *const *argv) {
 
 int main(int argc, const char *const *argv) {
   jmp_buf ejbuf;
-  static void (*actionfunction)(const char *const *argv);
+  void (*actionfunction)(const char *const *argv);
 
   setlocale(LC_ALL, "");
   bindtextdomain(PACKAGE, LOCALEDIR);

+ 1 - 1
src/query.c

@@ -662,7 +662,7 @@ static const struct cmdinfo cmdinfos[]= {
 
 int main(int argc, const char *const *argv) {
   jmp_buf ejbuf;
-  static void (*actionfunction)(const char *const *argv);
+  void (*actionfunction)(const char *const *argv);
 
   setlocale(LC_ALL, "");
   bindtextdomain(PACKAGE, LOCALEDIR);

+ 1 - 1
src/statcmd.c

@@ -412,7 +412,7 @@ int
 main(int argc, const char *const *argv)
 {
 	jmp_buf ejbuf;
-	static int (*actionfunction)(const char *const *argv);
+	int (*actionfunction)(const char *const *argv);
 	int ret;
 
 	setlocale(LC_ALL, "");