2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-13 00:12:11 +00:00

Inline object functions.

[SVN r75939]
This commit is contained in:
Steven Watanabe
2011-12-14 19:33:14 +00:00
parent 750a25dda0
commit 298670d665
2 changed files with 28 additions and 2 deletions

View File

@@ -29,6 +29,8 @@
#define OBJECT_MAGIC 0xa762e0e3u
#ifndef object_copy
struct hash_header
{
#ifndef NDEBUG
@@ -38,6 +40,8 @@ struct hash_header
struct hash_item * next;
};
#endif
struct hash_item
{
struct hash_header header;
@@ -257,6 +261,7 @@ OBJECT * object_new( const char * string )
#endif
}
#ifndef object_copy
/*
* object_copy() - return a copy of an object
@@ -330,6 +335,8 @@ unsigned int object_hash( OBJECT * obj )
#endif
}
#endif
/*
* object_done() - free string tables.
*/

View File

@@ -14,11 +14,30 @@
typedef struct _object OBJECT;
OBJECT * object_new ( const char * );
void object_done ( void );
#if defined(NDEBUG) && !defined(BJAM_NO_MEM_CACHE)
struct hash_header
{
unsigned int hash;
struct hash_item * next;
};
#define object_str( obj ) ( (const char *)( obj ) )
#define object_copy( obj ) ( obj )
#define object_free( obj ) ( (void)0 )
#define object_equal( lhs, rhs ) ( ( lhs ) == ( rhs ) )
#define object_hash( obj ) ( ((struct hash_header *)( (char *)( obj ) - sizeof(struct hash_header) ))->hash )
#else
const char * object_str ( OBJECT * );
OBJECT * object_copy ( OBJECT * );
void object_free ( OBJECT * );
const char * object_str ( OBJECT * );
void object_done ( void );
int object_equal ( OBJECT *, OBJECT * );
unsigned int object_hash ( OBJECT * );
#endif
#endif