From 2e9d2660b386c1e1df799c0007d4b34711aaba69 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 12 Jan 2016 21:40:53 +0100 Subject: [PATCH] Don't use macro names that contain `__' [2/2]. Such macro names are reserved for both C and C++. * src/cache/*: s/__/_/. --- ChangeLog | 10 +++++++++- src/cache/ftccache.c | 10 +++++----- src/cache/ftccache.h | 12 ++++++------ src/cache/ftcglyph.c | 2 +- src/cache/ftcglyph.h | 6 +++--- src/cache/ftcimage.c | 2 +- src/cache/ftcimage.h | 4 ++-- src/cache/ftcmanag.c | 12 ++++++------ src/cache/ftcsbits.c | 2 +- src/cache/ftcsbits.h | 4 ++-- 10 files changed, 36 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5c3e99924..e2a605c5c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,18 @@ +2016-01-12 Werner Lemberg + + Don't use macro names that contain `__' [2/2]. + + Such macro names are reserved for both C and C++. + + * src/cache/*: s/__/_/. + 2016-01-12 Werner Lemberg Don't use macro names that contain `__' [1/2]. Such macro names are reserved for both C and C++. - */*: Replace macros of the form `__XXX_H__' with `XXX_H_'. + * */*: Replace macros of the form `__XXX_H__' with `XXX_H_'. 2016-01-10 Jered Gray diff --git a/src/cache/ftccache.c b/src/cache/ftccache.c index b82a78902..d42ae591d 100644 --- a/src/cache/ftccache.c +++ b/src/cache/ftccache.c @@ -85,7 +85,7 @@ /* get a top bucket for specified hash from cache, - * body for FTC_NODE__TOP_FOR_HASH( cache, hash ) + * body for FTC_NODE_TOP_FOR_HASH( cache, hash ) */ FT_LOCAL_DEF( FTC_Node* ) ftc_get_top_node_for_hash( FTC_Cache cache, @@ -224,7 +224,7 @@ ftc_node_hash_unlink( FTC_Node node0, FTC_Cache cache ) { - FTC_Node *pnode = FTC_NODE__TOP_FOR_HASH( cache, node0->hash ); + FTC_Node *pnode = FTC_NODE_TOP_FOR_HASH( cache, node0->hash ); for (;;) @@ -257,7 +257,7 @@ ftc_node_hash_link( FTC_Node node, FTC_Cache cache ) { - FTC_Node *pnode = FTC_NODE__TOP_FOR_HASH( cache, node->hash ); + FTC_Node *pnode = FTC_NODE_TOP_FOR_HASH( cache, node->hash ); node->link = *pnode; @@ -498,7 +498,7 @@ return FT_THROW( Invalid_Argument ); /* Go to the `top' node of the list sharing same masked hash */ - bucket = pnode = FTC_NODE__TOP_FOR_HASH( cache, hash ); + bucket = pnode = FTC_NODE_TOP_FOR_HASH( cache, hash ); /* Lookup a node with exactly same hash and queried properties. */ /* NOTE: _nodcomp() may change the linked list to reduce memory. */ @@ -518,7 +518,7 @@ if ( list_changed ) { /* Update bucket by modified linked list */ - bucket = pnode = FTC_NODE__TOP_FOR_HASH( cache, hash ); + bucket = pnode = FTC_NODE_TOP_FOR_HASH( cache, hash ); /* Update pnode by modified linked list */ while ( *pnode != node ) diff --git a/src/cache/ftccache.h b/src/cache/ftccache.h index 533670d74..1b5bd3b97 100644 --- a/src/cache/ftccache.h +++ b/src/cache/ftccache.h @@ -69,11 +69,11 @@ FT_BEGIN_HEADER #define FTC_NODE( x ) ( (FTC_Node)(x) ) #define FTC_NODE_P( x ) ( (FTC_Node*)(x) ) -#define FTC_NODE__NEXT( x ) FTC_NODE( (x)->mru.next ) -#define FTC_NODE__PREV( x ) FTC_NODE( (x)->mru.prev ) +#define FTC_NODE_NEXT( x ) FTC_NODE( (x)->mru.next ) +#define FTC_NODE_PREV( x ) FTC_NODE( (x)->mru.prev ) #ifdef FTC_INLINE -#define FTC_NODE__TOP_FOR_HASH( cache, hash ) \ +#define FTC_NODE_TOP_FOR_HASH( cache, hash ) \ ( ( cache )->buckets + \ ( ( ( ( hash ) & ( cache )->mask ) < ( cache )->p ) \ ? ( ( hash ) & ( ( cache )->mask * 2 + 1 ) ) \ @@ -82,7 +82,7 @@ FT_BEGIN_HEADER FT_LOCAL( FTC_Node* ) ftc_get_top_node_for_hash( FTC_Cache cache, FT_Offset hash ); -#define FTC_NODE__TOP_FOR_HASH( cache, hash ) \ +#define FTC_NODE_TOP_FOR_HASH( cache, hash ) \ ftc_get_top_node_for_hash( ( cache ), ( hash ) ) #endif @@ -220,7 +220,7 @@ FT_BEGIN_HEADER node = NULL; \ \ /* Go to the `top' node of the list sharing same masked hash */ \ - _bucket = _pnode = FTC_NODE__TOP_FOR_HASH( _cache, _hash ); \ + _bucket = _pnode = FTC_NODE_TOP_FOR_HASH( _cache, _hash ); \ \ /* Look up a node with identical hash and queried properties. */ \ /* NOTE: _nodcomp() may change the linked list to reduce memory. */ \ @@ -240,7 +240,7 @@ FT_BEGIN_HEADER if ( _list_changed ) \ { \ /* Update _bucket by possibly modified linked list */ \ - _bucket = _pnode = FTC_NODE__TOP_FOR_HASH( _cache, _hash ); \ + _bucket = _pnode = FTC_NODE_TOP_FOR_HASH( _cache, _hash ); \ \ /* Update _pnode by possibly modified linked list */ \ while ( *_pnode != _node ) \ diff --git a/src/cache/ftcglyph.c b/src/cache/ftcglyph.c index 343b8a779..a2a90ee7f 100644 --- a/src/cache/ftcglyph.c +++ b/src/cache/ftcglyph.c @@ -106,7 +106,7 @@ FTC_Family_Init( FTC_Family family, FTC_Cache cache ) { - FTC_GCacheClass clazz = FTC_CACHE__GCACHE_CLASS( cache ); + FTC_GCacheClass clazz = FTC_CACHE_GCACHE_CLASS( cache ); family->clazz = clazz->family_class; diff --git a/src/cache/ftcglyph.h b/src/cache/ftcglyph.h index 1fd78910d..6f00d1b42 100644 --- a/src/cache/ftcglyph.h +++ b/src/cache/ftcglyph.h @@ -245,10 +245,10 @@ FT_BEGIN_HEADER #define FTC_GCACHE_CLASS( x ) ((FTC_GCacheClass)(x)) -#define FTC_CACHE__GCACHE_CLASS( x ) \ +#define FTC_CACHE_GCACHE_CLASS( x ) \ FTC_GCACHE_CLASS( FTC_CACHE(x)->org_class ) -#define FTC_CACHE__FAMILY_CLASS( x ) \ - ( (FTC_MruListClass)FTC_CACHE__GCACHE_CLASS( x )->family_class ) +#define FTC_CACHE_FAMILY_CLASS( x ) \ + ( (FTC_MruListClass)FTC_CACHE_GCACHE_CLASS( x )->family_class ) /* convenience function; use it instead of FTC_Manager_Register_Cache */ diff --git a/src/cache/ftcimage.c b/src/cache/ftcimage.c index f519a6179..70dda75b4 100644 --- a/src/cache/ftcimage.c +++ b/src/cache/ftcimage.c @@ -70,7 +70,7 @@ FTC_GNode gnode = FTC_GNODE( inode ); FTC_Family family = gquery->family; FT_UInt gindex = gquery->gindex; - FTC_IFamilyClass clazz = FTC_CACHE__IFAMILY_CLASS( cache ); + FTC_IFamilyClass clazz = FTC_CACHE_IFAMILY_CLASS( cache ); /* initialize its inner fields */ diff --git a/src/cache/ftcimage.h b/src/cache/ftcimage.h index d00052b4b..fd4c985b0 100644 --- a/src/cache/ftcimage.h +++ b/src/cache/ftcimage.h @@ -72,8 +72,8 @@ FT_BEGIN_HEADER #define FTC_IFAMILY_CLASS( x ) ((FTC_IFamilyClass)(x)) -#define FTC_CACHE__IFAMILY_CLASS( x ) \ - FTC_IFAMILY_CLASS( FTC_CACHE__GCACHE_CLASS(x)->family_class ) +#define FTC_CACHE_IFAMILY_CLASS( x ) \ + FTC_IFAMILY_CLASS( FTC_CACHE_GCACHE_CLASS(x)->family_class ) /* can be used as a @FTC_Node_FreeFunc */ diff --git a/src/cache/ftcmanag.c b/src/cache/ftcmanag.c index 658614c8d..bbb70294f 100644 --- a/src/cache/ftcmanag.c +++ b/src/cache/ftcmanag.c @@ -494,7 +494,7 @@ else weight += cache->clazz.node_weight( node, cache ); - node = FTC_NODE__NEXT( node ); + node = FTC_NODE_NEXT( node ); } while ( node != first ); @@ -513,7 +513,7 @@ do { count++; - node = FTC_NODE__NEXT( node ); + node = FTC_NODE_NEXT( node ); } while ( node != first ); @@ -556,13 +556,13 @@ return; /* go to last node -- it's a circular list */ - node = FTC_NODE__PREV( first ); + node = FTC_NODE_PREV( first ); do { FTC_Node prev; - prev = ( node == first ) ? NULL : FTC_NODE__PREV( node ); + prev = ( node == first ) ? NULL : FTC_NODE_PREV( node ); if ( node->ref_count <= 0 ) ftc_node_destroy( node, manager ); @@ -641,10 +641,10 @@ return 0; /* go to last node - it's a circular list */ - node = FTC_NODE__PREV(first); + node = FTC_NODE_PREV(first); for ( result = 0; result < count; ) { - FTC_Node prev = FTC_NODE__PREV( node ); + FTC_Node prev = FTC_NODE_PREV( node ); /* don't touch locked nodes */ diff --git a/src/cache/ftcsbits.c b/src/cache/ftcsbits.c index 814171916..a35307074 100644 --- a/src/cache/ftcsbits.c +++ b/src/cache/ftcsbits.c @@ -215,7 +215,7 @@ FT_UInt gindex = gquery->gindex; FTC_Family family = gquery->family; - FTC_SFamilyClass clazz = FTC_CACHE__SFAMILY_CLASS( cache ); + FTC_SFamilyClass clazz = FTC_CACHE_SFAMILY_CLASS( cache ); FT_UInt total; FT_UInt node_count; diff --git a/src/cache/ftcsbits.h b/src/cache/ftcsbits.h index d61e4b9c8..32ac3e681 100644 --- a/src/cache/ftcsbits.h +++ b/src/cache/ftcsbits.h @@ -64,8 +64,8 @@ FT_BEGIN_HEADER #define FTC_SFAMILY_CLASS( x ) ((FTC_SFamilyClass)(x)) -#define FTC_CACHE__SFAMILY_CLASS( x ) \ - FTC_SFAMILY_CLASS( FTC_CACHE__GCACHE_CLASS( x )->family_class ) +#define FTC_CACHE_SFAMILY_CLASS( x ) \ + FTC_SFAMILY_CLASS( FTC_CACHE_GCACHE_CLASS( x )->family_class ) FT_LOCAL( void )