Author: emaste
Date: Mon Apr 22 17:29:26 2019
New Revision: 346569
URL: https://svnweb.freebsd.org/changeset/base/346569
Log:
  ar: use array notation to access s_so
  
  This is somewhat more readable than pointer arithmetic.  Also remove an
  unnecessary cast while here.
  
  MFC after:    1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.bin/ar/write.c

Modified: head/usr.bin/ar/write.c
==============================================================================
--- head/usr.bin/ar/write.c     Mon Apr 22 17:25:00 2019        (r346568)
+++ head/usr.bin/ar/write.c     Mon Apr 22 17:29:26 2019        (r346569)
@@ -673,11 +673,11 @@ write_objs(struct bsdar *bsdar)
 
                for (i = 0; (size_t)i < bsdar->s_cnt; i++) {
                        if (w_sz == sizeof(uint32_t))
-                               *(bsdar->s_so + i) =
-                                   htobe32((uint32_t)(*(bsdar->s_so + i)) + 
pm_sz);
+                               bsdar->s_so[i] =
+                                   htobe32(bsdar->s_so[i] + pm_sz);
                        else
-                               *(bsdar->s_so + i) =
-                                   htobe64(*(bsdar->s_so + i) + pm_sz);
+                               bsdar->s_so[i] =
+                                   htobe64(bsdar->s_so[i] + pm_sz);
                }
        }
 


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

Reply via email to