[speedtouch] Re: void report() code comments

2003-10-12 Thread Edouard Gomez

Applied

-- 
Edouard Gomez

-- Attached file included as plaintext by Listar --
-- File: signature.asc
-- Desc: Digital signature

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/iV4rR5dTYz5sWMcRAkLEAJ9XgksB+VOYshWTSpIUbU1BfRDcSACaA6It
D321roSpyo9HG+LVuM3Cj4M=
=0ogT
-END PGP SIGNATURE-


Liste de diffusion modem ALCATEL SpeedTouch USB
Pour se désinscrire : mailto:[EMAIL PROTECTED]




[speedtouch] Re: void report() code comments

2003-10-05 Thread Leonard den Ottolander

Hello Edouard,

 I oversaw this email, so some of my comments in my last mail don't apply anymore. I 
see you 
already applied the verbosity patch to pppoa2.c as well. For the verbosity patch for 
modem_run.c 
see my previous mail.

 Waiting for your patch, i'll then judge if it's worth it (for the
 beauty of code)

 I had a closer look and noticed that since vsnprintf(msg, 256, format, ap) nor 
vfprintf(log, 
format, ap) use va_arg the reordering of the report() parameters is not as trivial as 
I expected. 
Let's forget about that (for now).

 However, I still feel the log level should be separated independent of whether 
REPORT_DUMP is set. 
This results in the following patch:

diff -pruN speedtouch/src/modem_run.c speedtouch.report_cleanup/src/modem_run.c
--- speedtouch/src/modem_run.c  2003-09-30 23:51:55.0 +0200
+++ speedtouch.report_cleanup/src/modem_run.c   2003-10-05 23:34:02.0 +0200
@@ -1214,38 +1214,24 @@ void report( int minlevel, unsigned int 
 #endif
 
/* Prints log message */
-   if(!(flagsREPORT_DUMP)) {
-#ifndef USE_SYSLOG
-   vfprintf(flog, format, ap);
-#else
-   char msg[256];
-
-   vsnprintf(msg, 256, format, ap);
-   syslog(LOG_INFO, msg);
-#endif
-   }
-   else {
-
-#ifdef USE_SYSLOG
-   unsigned char msg[256];
-#endif
-
+   if(flags  REPORT_DUMP) {
buffer = va_arg(ap, char*);
length = va_arg(ap, int);
+   }
 
 #ifndef USE_SYSLOG
-   vfprintf(flog, format, ap);
+   vfprintf(flog, format, ap);
 #else
-   vsnprintf(msg, 256, format, ap);
-   if(flagsREPORT_ERROR)
-   syslog(LOG_ERR, msg);
-   else if (flagsREPORT_INFO)
-   syslog(LOG_INFO, msg);
-   else if (flagsREPORT_DEBUG)
-   syslog(LOG_DEBUG, msg);
-#endif
+   char msg[256];
 
-   }
+   vsnprintf(msg, 256, format, ap);
+   if(flagsREPORT_ERROR)
+   syslog(LOG_ERR, msg);
+   else if (flagsREPORT_INFO)
+   syslog(LOG_INFO, msg);
+   else if (flagsREPORT_DEBUG)
+   syslog(LOG_DEBUG, msg);
+#endif
 
 #ifndef USE_SYSLOG
/* If needed we include the strerror from libc */
diff -pruN speedtouch/src/pppoa2.c speedtouch.report_cleanup/src/pppoa2.c
--- speedtouch/src/pppoa2.c 2003-09-30 23:51:55.0 +0200
+++ speedtouch.report_cleanup/src/pppoa2.c  2003-10-05 23:28:27.0 +0200
@@ -720,35 +720,24 @@ void report( int minlevel, unsigned int 
 
 #endif
/* Prints log message */
-   if(!(flagsREPORT_DUMP)) {
-#ifndef USE_SYSLOG
-   vprintf(format, ap);
-#else
-   char msg[256];
-
-   vsnprintf(msg, 256, format, ap);
-   syslog(LOG_INFO, msg);
-#endif
-   }
-   else {
-#ifdef USE_SYSLOG
-   unsigned char msg[256];
-#endif
+   if(flags  REPORT_DUMP) {
buffer = va_arg(ap, char*);
length = va_arg(ap, int);
+   }
 
 #ifndef USE_SYSLOG
-   vprintf(format, ap);
+   vprintf(format, ap);
 #else
-   vsnprintf(msg, 256, format, ap);
-   if(flagsREPORT_ERROR)
-   syslog(LOG_ERR, msg);
-   else if (flagsREPORT_INFO)
-   syslog(LOG_INFO, msg);
-   else if (flagsREPORT_DEBUG)
-   syslog(LOG_DEBUG, msg);
+   char msg[256];
+
+   vsnprintf(msg, 256, format, ap);
+   if(flagsREPORT_ERROR)
+   syslog(LOG_ERR, msg);
+   else if (flagsREPORT_INFO)
+   syslog(LOG_INFO, msg);
+   else if (flagsREPORT_DEBUG)
+   syslog(LOG_DEBUG, msg);
 #endif
-   }
 
 #ifndef USE_SYSLOG
/* If needed we include the strerror from libc */
diff -pruN speedtouch/src/pppoa3.c speedtouch.report_cleanup/src/pppoa3.c
--- speedtouch/src/pppoa3.c 2003-09-30 23:51:55.0 +0200
+++ speedtouch.report_cleanup/src/pppoa3.c  2003-10-05 23:34:55.0 +0200
@@ -1798,38 +1798,24 @@ void report( int minlevel, unsigned int 
 #endif
 
/* Prints log message */
-   if(!(flagsREPORT_DUMP)) {
-#ifndef USE_SYSLOG
-   vfprintf(log, format, ap);
-#else
-   char msg[256];
-
-   vsnprintf(msg, 256, format, ap);
-   syslog(LOG_INFO, msg);

[speedtouch] Re: void report() code comments

2003-09-30 Thread Edouard Gomez

Leonard den Ottolander ([EMAIL PROTECTED]) wrote:
  I  am  happy to  supply  a patch  that  fixes  this for  modem_run.c,
 pppoa2.c and pppoa3.c.

Waiting for your patch, i'll then judge if it's worth it (for the
beauty of code)

Thanks.

-- 
Edouard Gomez

-- Attached file included as plaintext by Listar --
-- File: signature.asc
-- Desc: Digital signature

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/efz3R5dTYz5sWMcRAiuKAKDYrpTvnv9zavv2rZgd43Bz0ZOVQgCgtPAc
amnPmeYppMnHMdxtNsWDbwE=
=KKUX
-END PGP SIGNATURE-


Liste de diffusion modem ALCATEL SpeedTouch USB
Pour se désinscrire : mailto:[EMAIL PROTECTED]