Hello Guiseppe,

Am Thursday 29 March 2012 schrieb Giuseppe Scrivano:
> Hello Tim,
> 
> Tim Ruehsen <tim.rueh...@gmx.de> writes:
> > function declaration isn't a prototype [-Wstrict-prototypes]
> > no previous prototype for 'convert_links_in_hashtable'
> > [-Wmissing-prototypes] suggest braces around empty body in an 'else'
> > statement [-Wempty-body]
> > 
> > please apply it to the repository.
> 
> please provide a ChangeLog entry for these entries.  Look at other
> entries in the ChangeLog file to see how it should be done.

Sorry, added now.

> 
> >            else
> > 
> > +            {
> > 
> >              /* Error in expiration spec.  Assume default (cookie doesn't
> >              
> >                 expire, but valid only for this session.)  */
> > 
> > -            ;
> > +            }
> > 
> >          }
> >        
> >        else if (TOKEN_IS (name, "max-age"))
> >        
> >          {
> > 
> > @@ -434,8 +435,9 @@
> > 
> >            cookie->secure = 1;
> >          
> >          }
> >        
> >        else
> > 
> > +        {
> > 
> >          /* Ignore unrecognized attribute. */
> > 
> > -        ;
> > +        }
> 
> I would rather move these comments near the if and explain what happens
> in the particular case.  An empty branch is quite ugly.

You are right. I removed both branches.
In the first case, i moved/changed the comment near the if.
For the second case, I left the comment at the bottom, since one would expect 
it there. The new comment looks like /* else: Ignore... */

> 
> > +# ifndef HAVE_LIBUUID
> > 
> >  /* Fills uuid_str with a UUID based on random numbers.
> >  
> >     (See RFC 4122, UUID version 4.)
> > 
> > @@ -612,6 +613,7 @@
> > 
> >      uuid_data[10], uuid_data[11], uuid_data[12], uuid_data[13],
> >      uuid_data[14], uuid_data[15]);
> >  
> >  }
> > 
> > +#endif
> 
> Please provide it as a separate patch.

I separated it and provide it later.

Tim
=== modified file 'src/ChangeLog'
--- src/ChangeLog	2012-03-25 15:49:55 +0000
+++ src/ChangeLog	2012-03-30 08:12:28 +0000
@@ -1,3 +1,24 @@
+2012-03-30  Tim Ruehsen  <tim.rueh...@gmx.de>
+
+	* convert.c: made convert_links_in_hashtable() static
+	* cookies.c: removed empty else branches
+	* css-url.c: include css-url.h, made get_uri_string() static
+	* css-url.h: added protoype for get_urls_css()
+	* gnutls.c: prototyped declaration of ssl_init()
+	* html-parse.c: made tagstack_push(),tagstack_pop(),tagstack_find() static
+	* html-url.c: made cleanup_html_url() static
+	* progress.c: made count_cols(),get_eta() static
+	* retr.h: removed protoype convert_to_bits() (moving to util.h)
+	* util.h: added protoype convert_to_bits()
+	* spider.c: made spider_cleanup() static
+	* warc.c: prototyped declaration of warc_write_start_record(),
+	    warc_write_end_record(),warc_start_cdx_file(),warc_init(),
+	    warc_load_cdx_dedup_file(),warc_write_metadata(),warc_close(),
+	    warc_tempfile().
+	    made warc_write_warcinfo_record(),warc_load_cdx_dedup_file(),
+	    warc_write_metadata() static
+	* warc.h: fixed protoypes for warc_init(),warc_close(),warc_tempfile()
+
 2012-03-25  Giuseppe Scrivano  <gscriv...@gnu.org>

 	* utils.c: Include <sys/ioctl.h>.

=== modified file 'src/convert.c'
--- src/convert.c	2011-01-01 12:19:37 +0000
+++ src/convert.c	2012-03-27 15:11:05 +0000
@@ -58,7 +58,7 @@
 static void convert_links (const char *, struct urlpos *);


-void
+static void
 convert_links_in_hashtable (struct hash_table *downloaded_set,
                             int is_css,
                             int *file_count)

=== modified file 'src/cookies.c'
--- src/cookies.c	2011-08-02 20:58:38 +0000
+++ src/cookies.c	2012-03-30 07:54:14 +0000
@@ -391,6 +391,8 @@
             goto error;
           BOUNDED_TO_ALLOCA (value.b, value.e, value_copy);

+          /* Check if expiration spec is valid.
+             If not, assume default (cookie doesn't expire, but valid only for this session.) */
           expires = http_atotm (value_copy);
           if (expires != (time_t) -1)
             {
@@ -402,10 +404,6 @@
               if (cookie->expiry_time < cookies_now)
                 cookie->discard_requested = 1;
             }
-          else
-            /* Error in expiration spec.  Assume default (cookie doesn't
-               expire, but valid only for this session.)  */
-            ;
         }
       else if (TOKEN_IS (name, "max-age"))
         {
@@ -433,9 +431,7 @@
           /* ignore value completely */
           cookie->secure = 1;
         }
-      else
-        /* Ignore unrecognized attribute. */
-        ;
+      /* else: Ignore unrecognized attribute. */
     }
   if (*ptr)
     /* extract_param has encountered a syntax error */

=== modified file 'src/css-url.c'
--- src/css-url.c	2011-01-01 12:19:37 +0000
+++ src/css-url.c	2012-03-27 15:17:02 +0000
@@ -55,6 +55,7 @@
 #include "convert.h"
 #include "html-url.h"
 #include "css-tokens.h"
+#include "css-url.h"

 /* from lex.yy.c */
 extern char *yytext;
@@ -107,7 +108,7 @@
   whitespace after the opening parenthesis and before the closing
   parenthesis.
 */
-char *
+static char *
 get_uri_string (const char *at, int *pos, int *length)
 {
   char *uri;

=== modified file 'src/css-url.h'
--- src/css-url.h	2011-01-01 12:19:37 +0000
+++ src/css-url.h	2012-03-27 15:15:41 +0000
@@ -31,6 +31,7 @@
 #define CSS_URL_H

 void get_urls_css (struct map_context *, int, int);
+void get_urls_css (struct map_context *, int, int);
 struct urlpos *get_urls_css_file (const char *, const char *);

 #endif /* CSS_URL_H */

=== modified file 'src/gnutls.c'
--- src/gnutls.c	2012-02-23 10:11:49 +0000
+++ src/gnutls.c	2012-03-27 15:34:40 +0000
@@ -61,7 +61,7 @@

 static gnutls_certificate_credentials credentials;
 bool
-ssl_init ()
+ssl_init (void)
 {
   /* Becomes true if GnuTLS is initialized. */
   static bool ssl_initialized = false;

=== modified file 'src/html-parse.c'
--- src/html-parse.c	2011-01-01 12:19:37 +0000
+++ src/html-parse.c	2012-03-27 15:20:32 +0000
@@ -280,7 +280,7 @@
   struct tagstack_item *next;
 };

-struct tagstack_item *
+static struct tagstack_item *
 tagstack_push (struct tagstack_item **head, struct tagstack_item **tail)
 {
   struct tagstack_item *ts = xmalloc(sizeof(struct tagstack_item));
@@ -301,7 +301,7 @@
 }

 /* remove ts and everything after it from the stack */
-void
+static void
 tagstack_pop (struct tagstack_item **head, struct tagstack_item **tail,
               struct tagstack_item *ts)
 {
@@ -343,7 +343,7 @@
     }
 }

-struct tagstack_item *
+static struct tagstack_item *
 tagstack_find (struct tagstack_item *tail, const char *tagname_begin,
                const char *tagname_end)
 {

=== modified file 'src/html-url.c'
--- src/html-url.c	2011-04-24 11:03:48 +0000
+++ src/html-url.c	2012-03-27 15:20:28 +0000
@@ -829,7 +829,7 @@
   return head;
 }

-void
+static void
 cleanup_html_url (void)
 {
   /* Destroy the hash tables.  The hash table keys and values are not

=== modified file 'src/progress.c'
--- src/progress.c	2012-03-05 21:23:06 +0000
+++ src/progress.c	2012-03-27 15:24:14 +0000
@@ -766,7 +766,7 @@
 }

 #if USE_NLS_PROGRESS_BAR
-int
+static int
 count_cols (const char *mbs)
 {
   wchar_t wc;
@@ -795,7 +795,7 @@
 # define count_cols(mbs) ((int)(strlen(mbs)))
 #endif

-const char *
+static const char *
 get_eta (int *bcd)
 {
   /* TRANSLATORS: "ETA" is English-centric, but this must

=== modified file 'src/retr.h'
--- src/retr.h	2012-03-05 21:23:06 +0000
+++ src/retr.h	2012-03-27 15:28:24 +0000
@@ -75,6 +75,4 @@

 bool input_file_url (const char *);

-wgint convert_to_bits (wgint num);
-
 #endif /* RETR_H */

=== modified file 'src/spider.c'
--- src/spider.c	2011-01-01 12:19:37 +0000
+++ src/spider.c	2012-03-27 15:24:11 +0000
@@ -45,7 +45,7 @@

 /* Cleanup the data structures associated with this file.  */

-void
+static void
 spider_cleanup (void)
 {
   if (nonexisting_urls_set)

=== modified file 'src/utils.h'
--- src/utils.h	2011-01-01 12:19:37 +0000
+++ src/utils.h	2012-03-27 15:29:05 +0000
@@ -127,6 +127,7 @@
 int numdigit (wgint);
 char *number_to_string (char *, wgint);
 char *number_to_static_string (wgint);
+wgint convert_to_bits (wgint);

 int determine_screen_width (void);
 int random_number (int);

=== modified file 'src/warc.c'
--- src/warc.c	2012-02-25 10:58:21 +0000
+++ src/warc.c	2012-03-27 15:27:06 +0000
@@ -180,7 +180,7 @@
    Returns false and set warc_write_ok to false if there
    is an error.  */
 static bool
-warc_write_start_record ()
+warc_write_start_record (void)
 {
   if (!warc_write_ok)
     return false;
@@ -279,7 +279,7 @@
    with the uncompressed and compressed length of the
    record. */
 static bool
-warc_write_end_record ()
+warc_write_end_record (void)
 {
   warc_write_buffer ("\r\n\r\n", 4);

@@ -634,7 +636,7 @@

 /* Write a warcinfo record to the current file.
    Updates warc_current_warcinfo_uuid_str. */
-bool
+static bool
 warc_write_warcinfo_record (char *filename)
 {
   /* Write warc-info record as the first record of the file. */
@@ -761,7 +763,7 @@

 /* Opens the CDX file for output. */
 static bool
-warc_start_cdx_file ()
+warc_start_cdx_file (void)
 {
   int filename_length = strlen (opt.warc_filename);
   char *cdx_filename = alloca (filename_length + 4 + 1);
@@ -900,8 +902,8 @@

 /* Loads the CDX file from opt.warc_cdx_dedup_filename and fills
    the warc_cdx_dedup_table. */
-bool
-warc_load_cdx_dedup_file ()
+static bool
+warc_load_cdx_dedup_file (void)
 {
   FILE *f = fopen (opt.warc_cdx_dedup_filename, "r");
   if (f == NULL)
@@ -985,7 +987,7 @@
 /* Initializes the WARC writer (if opt.warc_filename is set).
    This should be called before any WARC record is written. */
 void
-warc_init ()
+warc_init (void)
 {
   warc_write_ok = true;

@@ -1039,8 +1041,8 @@
 }

 /* Writes metadata (manifest, configuration, log file) to the WARC file. */
-void
-warc_write_metadata ()
+static void
+warc_write_metadata (void)
 {
   /* If there are multiple WARC files, the metadata should be written to a separate file. */
   if (opt.warc_maxsize > 0)
@@ -1087,7 +1089,7 @@
 /* Finishes the WARC writing.
    This should be called at the end of the program. */
 void
-warc_close ()
+warc_close (void)
 {
   if (warc_current_file != NULL)
     {
@@ -1108,7 +1110,7 @@
    The temporary file will be created in opt.warc_tempdir.
    Returns the pointer to the temporary file, or NULL. */
 FILE *
-warc_tempfile ()
+warc_tempfile (void)
 {
   char filename[100];
   if (path_search (filename, 100, opt.warc_tempdir, "wget", true) == -1)

=== modified file 'src/warc.h'
--- src/warc.h	2012-02-25 10:58:21 +0000
+++ src/warc.h	2012-03-27 15:00:38 +0000
@@ -4,12 +4,12 @@

 #include "host.h"

-void warc_init ();
-void warc_close ();
+void warc_init (void);
+void warc_close (void);
 void warc_timestamp (char *timestamp);
 void warc_uuid_str (char *id_str);

-FILE * warc_tempfile ();
+FILE * warc_tempfile (void);

 bool warc_write_request_record (char *url, char *timestamp_str, char *concurrent_to_uuid, ip_address *ip, FILE *body, off_t payload_offset);
 bool warc_write_response_record (char *url, char *timestamp_str, char *concurrent_to_uuid, ip_address *ip, FILE *body, off_t payload_offset, char *mime_type, int response_code, char *redirect_location);

Reply via email to