cast pid_t to int when using *printf

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема cast pid_t to int when using *printf
Дата
Msg-id 4153C407.8000005@opencloud.com
обсуждение исходный текст
Ответы Re: cast pid_t to int when using *printf
Список pgsql-patches
gcc (3.2.3 on Solaris 9) warns about a couple of places where a pid_t is
formatted with %d by a printf-family function. This patch explicitly
casts to int to suppress the warning.

-O
Index: src/backend/postmaster/pgstat.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/backend/postmaster/pgstat.c,v
retrieving revision 1.80
diff -u -c -r1.80 pgstat.c
*** src/backend/postmaster/pgstat.c    29 Aug 2004 05:06:46 -0000    1.80
--- src/backend/postmaster/pgstat.c    24 Sep 2004 06:46:27 -0000
***************
*** 1505,1511 ****
      snprintf(pgStat_fname, MAXPGPATH, PGSTAT_STAT_FILENAME, DataDir);
      /* tmpfname need only be set correctly in this process */
      snprintf(pgStat_tmpfname, MAXPGPATH, PGSTAT_STAT_TMPFILE,
!              DataDir, getpid());

      /*
       * Arrange to write the initial status file right away
--- 1505,1511 ----
      snprintf(pgStat_fname, MAXPGPATH, PGSTAT_STAT_FILENAME, DataDir);
      /* tmpfname need only be set correctly in this process */
      snprintf(pgStat_tmpfname, MAXPGPATH, PGSTAT_STAT_TMPFILE,
!              DataDir, (int)getpid());

      /*
       * Arrange to write the initial status file right away
Index: src/backend/postmaster/postmaster.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/backend/postmaster/postmaster.c,v
retrieving revision 1.425
diff -u -c -r1.425 postmaster.c
*** src/backend/postmaster/postmaster.c    9 Sep 2004 00:59:33 -0000    1.425
--- src/backend/postmaster/postmaster.c    24 Sep 2004 06:46:27 -0000
***************
*** 2835,2841 ****
       */
      ereport(DEBUG3,
              (errmsg_internal("%s child[%d]: starting with (",
!                              progname, getpid())));
      for (i = 0; i < ac; ++i)
          ereport(DEBUG3,
                  (errmsg_internal("\t%s", av[i])));
--- 2835,2841 ----
       */
      ereport(DEBUG3,
              (errmsg_internal("%s child[%d]: starting with (",
!                              progname, (int)getpid())));
      for (i = 0; i < ac; ++i)
          ereport(DEBUG3,
                  (errmsg_internal("\t%s", av[i])));

В списке pgsql-patches по дате отправления:

Предыдущее
От: Oliver Jowett
Дата:
Сообщение: Support LDFLAGS_SL on most ports
Следующее
От: Neil Conway
Дата:
Сообщение: Re: cast pid_t to int when using *printf