emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r101049: Fix -Wwrite-strings warnings


From: Jan D
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r101049: Fix -Wwrite-strings warnings in fakemail.c.
Date: Wed, 11 Aug 2010 11:16:35 +0200
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 101049
committer: Jan D <address@hidden>
branch nick: trunk
timestamp: Wed 2010-08-11 11:16:35 +0200
message:
  Fix -Wwrite-strings warnings in fakemail.c.
  
  * fakemail.c: Include stdlib.h for getenv. Remove declaration of
  popen, fclose and pclose.
  (my_name, fatal, error, put_line): Use const char*
  (main): Remove extern getenv, mail_program_name is const char*.
modified:
  lib-src/ChangeLog
  lib-src/fakemail.c
=== modified file 'lib-src/ChangeLog'
--- a/lib-src/ChangeLog 2010-08-11 08:20:34 +0000
+++ b/lib-src/ChangeLog 2010-08-11 09:16:35 +0000
@@ -1,5 +1,10 @@
 2010-08-11  Jan Djärv  <address@hidden>
 
+       * fakemail.c: Include stdlib.h for getenv. Remove declaration of
+       popen, fclose and pclose.
+       (my_name, fatal, error, put_line): Use const char*
+       (main): Remove extern getenv, mail_program_name is const char*.
+
        * update-game-score.c (get_prefix, write_scores, main): Use const char*.
 
        * sorted-doc.c (error, fatal, states): Use const char *.

=== modified file 'lib-src/fakemail.c'
--- a/lib-src/fakemail.c        2010-08-11 08:20:34 +0000
+++ b/lib-src/fakemail.c        2010-08-11 09:16:35 +0000
@@ -59,6 +59,7 @@
 #include <ctype.h>
 #include <time.h>
 #include <pwd.h>
+#include <stdlib.h>
 
 /* This is to declare cuserid.  */
 #ifdef HAVE_UNISTD_H
@@ -140,21 +141,16 @@
 #define MAIL_PROGRAM_NAME "/bin/mail"
 #endif
 
-static char *my_name;
+static const char *my_name;
 static char *the_date;
 static char *the_user;
 static line_list file_preface;
 static stream_list the_streams;
 static boolean no_problems = true;
 
-static void fatal (char *s1) NO_RETURN;
-
-extern FILE *popen (const char *, const char *);
-extern int fclose (FILE *), pclose (FILE *);
+static void fatal (const char *s1) NO_RETURN;
 
 #ifdef CURRENT_USER
-extern struct passwd *getpwuid ();
-extern unsigned short geteuid ();
 static struct passwd *my_entry;
 #define cuserid(s)                             \
 (my_entry = getpwuid (((int) geteuid ())),     \
@@ -166,7 +162,7 @@
 /* Print error message.  `s1' is printf control string, `s2' is arg for it. */
 
 static void
-error (char *s1, char *s2)
+error (const char *s1, const char *s2)
 {
   printf ("%s: ", my_name);
   printf (s1, s2);
@@ -177,7 +173,7 @@
 /* Print error message and exit.  */
 
 static void
-fatal (char *s1)
+fatal (const char *s1)
 {
   error ("%s", s1);
   exit (EXIT_FAILURE);
@@ -464,20 +460,20 @@
 }
 
 void
-put_line (char *string)
+put_line (const char *string)
 {
   register stream_list rem;
   for (rem = the_streams;
        rem != ((stream_list) NULL);
        rem = rem->rest_streams)
     {
-      char *s = string;
+      const char *s = string;
       int column = 0;
 
       /* Divide STRING into lines.  */
       while (*s != 0)
        {
-         char *breakpos;
+         const char *breakpos;
 
          /* Find the last char that fits.  */
          for (breakpos = s; *breakpos && column < 78; ++breakpos)
@@ -699,13 +695,11 @@
   char *command_line;
   header the_header;
   long name_length;
-  char *mail_program_name;
+  const char *mail_program_name;
   char buf[BUFLEN + 1];
   register int size;
   FILE *the_pipe;
 
-  extern char *getenv (const char *);
-
   mail_program_name = getenv ("FAKEMAILER");
   if (!(mail_program_name && *mail_program_name))
     mail_program_name = MAIL_PROGRAM_NAME;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]