]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Supercede b8856: old compiler support
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 15 Jul 2008 11:51:16 +0000 (23:51 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 15 Jul 2008 11:51:16 +0000 (23:51 +1200)
Seems the (void) casting method indicated as the best method to fix
unused return warning does not actually work. :-(

Of the other approaches, I'm picking this one used previously by the
SuSE Linux port of Squid as the cleanest.

Thanks Michael Bienia from the Ubuntu team for assistance testing.

lib/util.c
src/StoreIOBuffer.h
src/comm.cc
src/tools.cc

index 4e7ec2518a12ad7c8a90bc24f77d8159f8941951..8f48a267f4cab8a573e1251262f52a1f6be22e0d 100644 (file)
@@ -931,8 +931,8 @@ xint64toa(int64_t num)
 void
 default_failure_notify(const char *message)
 {
-    (void)write(2, message, strlen(message));
-    (void)write(2, "\n", 1);
+    if(write(2, message, strlen(message))) {}
+    if(write(2, "\n", 1)) {}
     abort();
 }
 
index 8649e15063fb1839c01b86e4df96315e9bc2fbd8..058fd3fc636f2595aa0313510c18232c9221bb7b 100644 (file)
@@ -68,8 +68,8 @@ public:
 
     void dump() const
     {
-        (void)fwrite(data, length, 1, stderr);
-        (void)fwrite("\n", 1, 1, stderr);
+        if(fwrite(data, length, 1, stderr)) {}
+        if(fwrite("\n", 1, 1, stderr)) {}
     }
 
     struct
index 212b6bae4ce2091c5e3da1912636a52634ae5f7b..5eecf5601d8145d2c1fb377f99ebee4928d56a41 100644 (file)
@@ -2220,7 +2220,7 @@ comm_accept(int fd, IOACB *handler, void *handler_data) {
 void CommIO::Initialise() {
     /* Initialize done pipe signal */
     int DonePipe[2];
-    (void)pipe(DonePipe);
+    if(pipe(DonePipe)) {}
     DoneFD = DonePipe[1];
     DoneReadFD = DonePipe[0];
     fd_open(DoneReadFD, FD_PIPE, "async-io completetion event: main");
index 93e9d0dfd6f9090d2bd30f5c8307db15af569687..ca8d6a8bbcdafb681cc2f790217bbb4e17f93eda 100644 (file)
@@ -152,7 +152,7 @@ mail_warranty(void)
 
     snprintf(command, 256, "%s %s < %s", Config.EmailProgram, Config.adminEmail, filename);
 
-    (void)system(command);             /* XXX should avoid system(3) */
+    if(system(command)) {}             /* XXX should avoid system(3) */
 
     unlink(filename);
 }