Minor cleanups.

This commit is contained in:
Jonathan Moore Liles 2008-05-03 11:46:48 -05:00
parent 4feb8d6a9a
commit 5f4fd49867
2 changed files with 12 additions and 12 deletions

View File

@ -42,7 +42,7 @@ Loggable::open ( const char *filename )
if ( ! ( fp = fopen( filename, "a+" ) ) )
{
printf( "Could not open log file for writing!" );
WARNING( "Could not open log file for writing!" );
return false;
}
@ -72,8 +72,7 @@ Loggable::open ( const char *filename )
/** sigh. parse a string of ":name value :name value" pairs into an
* array of strings, one per pair */
// FIXME: doesn't handle the case of :name ":foo bar", nested quotes
// or other things it should. Also, quotes should be removed here, not
// in client code.
// or other things it should.
static
char **
parse_alist( const char *s )
@ -84,7 +83,7 @@ parse_alist( const char *s )
int tl = strlen( s );
char **r = (char**)malloc( sizeof( char* ) * tl );
const char *e = s + tl;
// const char *e = s + tl;
const char *c = NULL;
int i = 0;
@ -124,7 +123,7 @@ parse_alist( const char *s )
{
// v++;
if ( v[ strlen( v ) - 1 ] != '"' )
printf( "error: invalid quoting in log entry!\n" );
WARNING( "invalid quoting in log entry!" );
else
{
v[ strlen( v ) - 1 ] = '\0';
@ -288,7 +287,7 @@ Loggable::undo ( void )
if ( ! strlen( s ) )
{
printf( "corrupt undo file or no undo entries.\n" );
WARNING( "corrupt undo file or no undo entries." );
return;
}
@ -297,10 +296,7 @@ Loggable::undo ( void )
s += strlen( s ) - 1;
if ( strtok( b, "\n" ) == NULL )
{
printf( "error, empty undo transaction!\n" );
abort();
}
FATAL( "empty undo transaction!\n" );
int n = 1;
while ( strtok( NULL, "\n" ) )
@ -332,7 +328,7 @@ Loggable::undo ( void )
if ( *s == '\t' )
s++;
printf( "undoing \"%s\"\n", s );
DMESSAGE( "undoing \"%s\"\n", s );
do_this( s, true );

View File

@ -34,6 +34,8 @@ using namespace std;
#include "types.h"
#include "debug.h"
class Log_Entry;
class Loggable;
typedef Loggable *(create_func)(Log_Entry &);
@ -155,7 +157,9 @@ public:
/* make sure it'll fit */
_loggables.reserve( _id );
assert( ! _loggables[ _id - 1 ] );
// assert( ! _loggables[ _id - 1 ] );
ASSERT( ! _loggables[ _id - 1 ], "Attempt to create object with an ID (0x%X) that already exists. The existing object is of type \"%s\", the new one is \"%s\". Corrupt journal?", _id, _loggables[ _id -1 ]->class_name(), class_name() );
_loggables[ _id - 1 ] = this;
}