summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Lam <plam@MIT.EDU>2006-04-07 17:27:39 +0000
committerPatrick Lam <plam@MIT.EDU>2006-04-07 17:27:39 +0000
commit44415a079a3e9951e0c2424edca4907a93a60db5 (patch)
treeb466550bddb38acd8be8c19e5f0919ef8f1e9ce1
parent91fe51b4f8cf792041bc5cad34797b87abd63e67 (diff)
downloadfontconfig-44415a079a3e9951e0c2424edca4907a93a60db5.tar.gz
Portability fixes for HP-UX (reported by Christoph Bauer). Replace
'__inline__' by AC_C_INLINE and 'inline'. Replace '__alignof__' by 'fc_alignof'. reviewed by: plam
-rw-r--r--ChangeLog15
-rw-r--r--configure.in1
-rw-r--r--src/fccharset.c4
-rw-r--r--src/fcfs.c2
-rw-r--r--src/fcint.h15
-rw-r--r--src/fclang.c2
-rw-r--r--src/fcname.c2
-rw-r--r--src/fcpat.c6
8 files changed, 33 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index d2e879d..560be03 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
2006-04-07 Dominic Lachowicz <cinamod@hotmail.com>
reviewed by: plam
+ * configure.in:
+ * src/fccharset.c (FcCharSetNeededBytes):
+ * src/fcfs.c (FcFontSetNeededBytes):
+ * src/fcint.h:
+ * src/fclang.c (FcLangSetNeededBytesAlign):
+ * src/fcname.c (FcObjectNeededBytesAlign):
+ * src/fcpat.c (FcPatternNeededBytesAlign,
+ FcValueListNeededBytesAlign, FcStrNeededBytesAlign):
+
+ Portability fixes for HP-UX (reported by Christoph Bauer).
+ Replace '__inline__' by AC_C_INLINE and 'inline'.
+ Replace '__alignof__' by 'fc_alignof'.
+
+2006-04-07 Dominic Lachowicz <cinamod@hotmail.com>
+ reviewed by: plam
* src/fcint.h:
Move up #include of config.h.
diff --git a/configure.in b/configure.in
index 4ec7abd..cfaf102 100644
--- a/configure.in
+++ b/configure.in
@@ -139,6 +139,7 @@ AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h iconv.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
+AC_C_INLINE
AC_TYPE_PID_T
# Checks for library functions.
diff --git a/src/fccharset.c b/src/fccharset.c
index 4607892..d1a9d6e 100644
--- a/src/fccharset.c
+++ b/src/fccharset.c
@@ -1335,8 +1335,8 @@ FcCharSetNeededBytes (const FcCharSet *c)
int
FcCharSetNeededBytesAlign (void)
{
- return __alignof__ (FcCharSet) + __alignof__ (int) +
- __alignof__ (FcCharLeaf) + __alignof__ (FcChar16);
+ return fc_alignof (FcCharSet) + fc_alignof (int) +
+ fc_alignof (FcCharLeaf) + fc_alignof (FcChar16);
}
static FcBool
diff --git a/src/fcfs.c b/src/fcfs.c
index bb7ff39..a9599ee 100644
--- a/src/fcfs.c
+++ b/src/fcfs.c
@@ -113,7 +113,7 @@ FcFontSetNeededBytes (FcFontSet *s)
int
FcFontSetNeededBytesAlign (void)
{
- return __alignof__(int) +
+ return fc_alignof (int) +
FcPatternNeededBytesAlign () + FcObjectNeededBytesAlign ();
}
diff --git a/src/fcint.h b/src/fcint.h
index 0a036b4..92e048e 100644
--- a/src/fcint.h
+++ b/src/fcint.h
@@ -321,6 +321,8 @@ typedef struct _FcCaseFold {
#define fc_value_langset(v) (((v)->type & FC_STORAGE_STATIC) ? (const FcLangSet *)(((char *) v) + (v)->u.l_off) : (v) -> u.l)
#define fc_storage_type(v) ((v)->type & ~FC_STORAGE_STATIC)
+#define fc_alignof(type) offsetof (struct { char c; type member; }, member)
+
/*
* The per-user ~/.fonts.cache-<version> file is loaded into
* this data structure. Each directory gets a substructure
@@ -432,7 +434,8 @@ typedef struct _FcFileTime {
typedef struct _FcCharMap FcCharMap;
-#define ALIGN(v,type) ((__typeof__(v))(((uintptr_t)(v) + __alignof__(type) - 1) & ~(__alignof__(type) - 1)))
+/* watch out; assumes that v is void * -PL */
+#define ALIGN(v,type) ((void *)(((uintptr_t)(v) + fc_alignof(type) - 1) & ~(fc_alignof(type) - 1)))
/* fcblanks.c */
@@ -482,7 +485,7 @@ extern int *_fcBankId, *_fcBankIdx;
int
FcCacheBankToIndexMTF (int bank);
-static __inline__ int
+static inline int
FcCacheBankToIndex (int bank)
{
return (_fcBankId[*_fcBankIdx] == bank) ? *_fcBankIdx : FcCacheBankToIndexMTF(bank);
@@ -622,7 +625,7 @@ FcSubstPrint (const FcSubst *subst);
extern int FcDebugVal;
-static __inline__ int
+static inline int
FcDebug (void) { return FcDebugVal; }
void
@@ -829,7 +832,7 @@ FcObjectSerialize (void);
const char *
FcObjectPtrU (FcObjectPtr p);
-static __inline__ int
+static inline int
FcObjectPtrCompare (const FcObjectPtr a, const FcObjectPtr b)
{
return a - b;
@@ -897,7 +900,7 @@ FcPatternDistributeBytes (FcCache * metadata, void * block_ptr);
extern FcValueList ** _fcValueLists;
extern FcPatternElt ** _fcPatternElts;
-static __inline__ FcValueList *
+static inline FcValueList *
FcValueListPtrU (FcValueListPtr pi)
{
if (pi.bank == FC_BANK_DYNAMIC)
@@ -906,7 +909,7 @@ FcValueListPtrU (FcValueListPtr pi)
return &_fcValueLists[FcCacheBankToIndex(pi.bank)][pi.u.stat];
}
-static __inline__ FcPatternElt *
+static inline FcPatternElt *
FcPatternEltU (FcPatternEltPtr pei)
{
if (pei.bank == FC_BANK_DYNAMIC)
diff --git a/src/fclang.c b/src/fclang.c
index e33afd2..7af6ed1 100644
--- a/src/fclang.c
+++ b/src/fclang.c
@@ -723,7 +723,7 @@ FcLangSetNeededBytes (const FcLangSet *l)
int
FcLangSetNeededBytesAlign (void)
{
- return __alignof__ (FcLangSet);
+ return fc_alignof (FcLangSet);
}
static FcBool
diff --git a/src/fcname.c b/src/fcname.c
index c6c187a..bc55d2c 100644
--- a/src/fcname.c
+++ b/src/fcname.c
@@ -342,7 +342,7 @@ FcObjectNeededBytes ()
int
FcObjectNeededBytesAlign (void)
{
- return __alignof__ (int) + __alignof__ (char);
+ return fc_alignof (int) + fc_alignof (char);
}
void *
diff --git a/src/fcpat.c b/src/fcpat.c
index 4162872..ba88ebf 100644
--- a/src/fcpat.c
+++ b/src/fcpat.c
@@ -1531,7 +1531,7 @@ FcPatternNeededBytes (FcPattern * p)
int
FcPatternNeededBytesAlign (void)
{
- return __alignof__ (FcPattern) + __alignof__ (FcPatternElt) +
+ return fc_alignof (FcPattern) + fc_alignof (FcPatternElt) +
FcValueListNeededBytesAlign ();
}
@@ -1725,7 +1725,7 @@ static int
FcValueListNeededBytesAlign (void)
{
return FcCharSetNeededBytesAlign() + FcLangSetNeededBytesAlign() +
- FcStrNeededBytesAlign() + __alignof__ (FcValueList);
+ FcStrNeededBytesAlign() + fc_alignof (FcValueList);
}
static FcBool
@@ -1928,7 +1928,7 @@ FcStrNeededBytes (const FcChar8 * s)
static int
FcStrNeededBytesAlign (void)
{
- return __alignof__ (char);
+ return fc_alignof (char);
}
static FcBool