Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Dec 2015 03:36:22 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r292902 - head/lib/libc/stdio
Message-ID:  <201512300336.tBU3aMQT000639@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Wed Dec 30 03:36:22 2015
New Revision: 292902
URL: https://svnweb.freebsd.org/changeset/base/292902

Log:
  Use __alignof__ instead of assuming int64_t to get the right
  alignment.
  
  Differential Revision: https://reviews.freebsd.org/D4708

Modified:
  head/lib/libc/stdio/findfp.c

Modified: head/lib/libc/stdio/findfp.c
==============================================================================
--- head/lib/libc/stdio/findfp.c	Wed Dec 30 02:26:04 2015	(r292901)
+++ head/lib/libc/stdio/findfp.c	Wed Dec 30 03:36:22 2015	(r292902)
@@ -99,16 +99,7 @@ moreglue(int n)
 	FILE *p;
 	size_t align;
 
-	/*
-	 * FILE has a mbstate_t variable. This variable tries to be int64_t
-	 * aligned through its definition. int64_t may be larger than void *,
-	 * which is the size traditionally used for ALIGNBYTES.  So, use our own
-	 * rounding instead of the MI ALIGN macros. If for some reason
-	 * ALIGNBYTES is larger than int64_t, respect that too. There appears to
-	 * be no portable way to ask for FILE's alignment requirements other
-	 * than just knowing here.
-	 */
-	align = MAX(ALIGNBYTES, sizeof(int64_t));
+	align = __alignof__(FILE);
 	g = (struct glue *)malloc(sizeof(*g) + align + n * sizeof(FILE));
 	if (g == NULL)
 		return (NULL);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201512300336.tBU3aMQT000639>