summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2005-01-04 08:51:18 +0000
committerJim Meyering <jim@meyering.net>2005-01-04 08:51:18 +0000
commit4dc772da913c7df19bb424427847b8254d8c0c1d (patch)
treec28d9ae17895007e52a69de56fe04c4a26677d4f
parenta9626a5d8187d42d9a7c8a95689dfd489df6b63a (diff)
downloadcoreutils-4dc772da913c7df19bb424427847b8254d8c0c1d.tar.xz
[DEFAULT_ALIGNMENT]: Use an intermediate type to simplify
offsetof() macro construct to avoid compile failure with native HP-UX 11.0 ANSI C compiler.
-rw-r--r--lib/obstack.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/obstack.c b/lib/obstack.c
index 25cb9abba..63396131c 100644
--- a/lib/obstack.c
+++ b/lib/obstack.c
@@ -1,7 +1,7 @@
/* obstack.c - subroutines used implicitly by object stack macros
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997,
- 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation,
+ 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation,
Inc.
This program is free software; you can redistribute it and/or modify
@@ -74,12 +74,17 @@ union fooround
long double d;
void *p;
};
+struct fooalign
+{
+ char c;
+ union fooround u;
+};
/* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT.
But in fact it might be less smart and round addresses to as much as
DEFAULT_ROUNDING. So we prepare for it to do that. */
enum
{
- DEFAULT_ALIGNMENT = offsetof (struct { char c; union fooround u; }, u),
+ DEFAULT_ALIGNMENT = offsetof (struct fooalign, u),
DEFAULT_ROUNDING = sizeof (union fooround)
};