On Sat, 4 Dec 2010, Colin Percival wrote:

Log:
 Remove gratuitous i386/amd64 inconsistency in favour of the less verbose
 version of declaring a variable initialized to zero.

This is resolved backwardsly.  style(9) forbids initializing variables in
declarations (except for the bug in it which allows this).

Modified: head/sys/i386/i386/busdma_machdep.c
==============================================================================
--- head/sys/i386/i386/busdma_machdep.c Sat Dec  4 23:24:35 2010        
(r216190)
+++ head/sys/i386/i386/busdma_machdep.c Sat Dec  4 23:36:40 2010        
(r216191)
@@ -858,7 +858,7 @@ bus_dmamap_load_uio(bus_dma_tag_t dmat,
                    bus_dmamap_callback2_t *callback, void *callback_arg,
                    int flags)
{
-       bus_addr_t lastaddr;
+       bus_addr_t lastaddr = 0;
        int nsegs, error, first, i;
        bus_size_t resid;
        struct iovec *iov;
@@ -878,7 +878,6 @@ bus_dmamap_load_uio(bus_dma_tag_t dmat,
        nsegs = 0;
        error = 0;
        first = 1;
-       lastaddr = (bus_addr_t) 0;

Also, here this is inconsisent with all the other initializations, since
those actually follow style(9).

Other style bugs visible in this patch:
- the declarations are totally disordered.  The initializations are at least
  in the same order as the declarations
- the cast in the old initialization of `lastaddr' was followed by a space.
  It is unclear if this cast is needed, and the new initialization doesn't
  have it.  It is not needed if bus_addr_t is a integer or pointer type,
  but bus_addr_t should be opaque.  If it is a pointer type, then the variable
  is not initialized to zero, but to a null pointer.  MD code like this can
  know what it is, but then you can't copy this code around.

Some of the other functions in this file have larger style bugs in
declarations/initializations than this.

Bruce
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to