cleanup: rename function and remove unused param

This commit is contained in:
Eric House 2015-12-31 15:47:48 -08:00
parent 02d5d26c60
commit 4813c95976
7 changed files with 14 additions and 15 deletions

View file

@ -94,9 +94,9 @@ dbg_logstream( const XWStreamCtxt* stream, const char* func, int line )
if ( !!stream ) {
XP_U16 len = 0;
XWStreamPos end = stream_getPos( stream, POS_WRITE );
stream_copyBits( stream, 0, end, NULL, &len );
stream_copyBits( stream, end, NULL, &len );
XP_U8 buf[len];
stream_copyBits( stream, 0, end, buf, &len );
stream_copyBits( stream, end, buf, &len );
char comment[128];
XP_SNPRINTF( comment, VSIZE(comment), "%s line %d", func, line );
LOG_HEX( buf, len, comment );

View file

@ -186,8 +186,8 @@ mem_stream_getBits( XWStreamCtxt* p_sctx, XP_U16 nBits )
#if defined HASH_STREAM || defined DEBUG
static void
mem_stream_copyBits( const XWStreamCtxt* p_sctx, XWStreamPos XP_UNUSED(startPos),
XWStreamPos endPos, XP_U8* buf, XP_U16* lenp )
mem_stream_copyBits( const XWStreamCtxt* p_sctx, XWStreamPos endPos,
XP_U8* buf, XP_U16* lenp )
{
MemStreamCtxt* stream = (MemStreamCtxt*)p_sctx;
XP_U16 len = BYTE_PART(endPos);

View file

@ -343,7 +343,7 @@ model_hashMatches( const ModelCtxt* model, const XP_U32 hash )
}
XP_Bool
model_revertToHash( ModelCtxt* model, const XP_U32 hash, PoolContext* pool )
model_popToHash( ModelCtxt* model, const XP_U32 hash, PoolContext* pool )
{
XP_U16 nPopped = 0;
StackCtxt* stack = model->vol.stack;

View file

@ -124,7 +124,7 @@ void model_setSize( ModelCtxt* model, XP_U16 boardSize );
void model_destroy( ModelCtxt* model );
XP_U32 model_getHash( const ModelCtxt* model, XP_U16 version );
XP_Bool model_hashMatches( const ModelCtxt* model, XP_U32 hash );
XP_Bool model_revertToHash( ModelCtxt* model, const XP_U32 hash,
XP_Bool model_popToHash( ModelCtxt* model, const XP_U32 hash,
PoolContext* pool );
void model_setNPlayers( ModelCtxt* model, XP_U16 numPlayers );

View file

@ -150,10 +150,10 @@ stack_getHash( const StackCtxt* stack )
XP_U32 hash = 0;
if ( !!stack->data ) {
XP_U16 len = 0;
stream_copyBits( stack->data, 0, stack->top, NULL, &len );
stream_copyBits( stack->data, stack->top, NULL, &len );
if ( 0 < len ) {
XP_U8 buf[len];
stream_copyBits( stack->data, 0, stack->top, buf, &len );
stream_copyBits( stack->data, stack->top, buf, &len );
#ifdef DEBUG_HASHING
LOG_HEX( buf, len, __func__ );
#endif

View file

@ -2087,8 +2087,7 @@ readMoveInfo( ServerCtxt* server, XWStreamCtxt* stream,
if ( STREAM_VERS_BIGBOARD <= stream_getVersion( stream ) ) {
XP_U32 hashReceived = stream_getU32( stream );
success = model_hashMatches( server->vol.model, hashReceived )
|| model_revertToHash( server->vol.model, hashReceived,
server->pool );
|| model_popToHash( server->vol.model, hashReceived, server->pool );
// XP_ASSERT( success ); /* I need to understand when this can fail */
#ifdef DEBUG_HASHING
if ( success ) {

View file

@ -49,8 +49,8 @@ typedef struct StreamCtxVTable {
XP_U32 (*m_stream_getU32)( XWStreamCtxt* dctx );
XP_U32 (*m_stream_getBits)( XWStreamCtxt* dctx, XP_U16 nBits );
#if defined HASH_STREAM || defined DEBUG
void (*m_stream_copyBits)( const XWStreamCtxt* dctx, XWStreamPos startPos,
XWStreamPos endPos, XP_U8* buf, XP_U16* len );
void (*m_stream_copyBits)( const XWStreamCtxt* dctx, XWStreamPos endPos,
XP_U8* buf, XP_U16* len );
#endif
void (*m_stream_putU8)( XWStreamCtxt* dctx, XP_U8 byt );
@ -114,8 +114,8 @@ struct XWStreamCtxt {
(sc)->vtable->m_stream_getBits((sc), (n))
#if defined HASH_STREAM || defined DEBUG
#define stream_copyBits(sc, s, e, b, l) \
(sc)->vtable->m_stream_copyBits((sc), (s), (e), (b), (l))
#define stream_copyBits(sc, e, b, l) \
(sc)->vtable->m_stream_copyBits((sc), (e), (b), (l))
#endif
#define stream_putU8(sc, b) \