Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
tintin++ ogg sound player script for linux
Author: Robert Smith
Submitted by: Vladaar
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
Users Online
CommonCrawl

Members: 0
Guests: 8
Stats
Files
Topics
Posts
Members
Newest Member
481
3,740
19,396
630
JadaGerste
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Bugfix Lists » AFKMud Bugfix List » [Bug] Log spam from null stri...
Forum Rules | Mark all | Recent Posts

[Bug] Log spam from null strings during mudprog editing
< Newer Topic :: Older Topic > AFKMud 2.0

Pages:<< prev 1 next >>
Post is unread #1 Jan 13, 2007, 10:20 am
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,644
JoinedJan 1, 2002

Bug: Log spam from null strings during mudprog editing
Danger: Trivial - Just an annoyance. No actual problem.
Discovered in: AFKMud 2.0
Found by: Kekkonen
Fixed by: Samson

---

build.c

Locate the function void mpedit and replace it with:
void mpedit( char_data *ch, mud_prog_data *mprg, int mptype, char *argument )
{
   if( mptype != -1 )
   {
      mprg->type = mptype;
      STRFREE( mprg->arglist );
      if( argument && argument[0] != '\0' )
         mprg->arglist = STRALLOC( argument );
   }
   ch->substate = SUB_MPROG_EDIT;
   ch->pcdata->dest_buf = mprg;

   ch->editor_desc_printf( "Program '%s %s'.", mprog_type_to_name( mprg->type ), mprg->arglist );
   ch->start_editing( mprg->comlist );
   return;
}


editor.c, char_data::start_editing ( the one that takes a char* argument )

Locate:
   if( !data )
      bug( "%s: data is NULL!", __FUNCTION__ );
   else
      for( ;; )
      {
         c = data[size++];
         if( c == '\0' )
         {
            edit->line[lines][lpos] = '\0';
            break;
         }
         else if( c == '\r' );
         else if( c == '\n' || lpos > 79 )
         {
            edit->line[lines][lpos] = '\0';
            ++lines;
            lpos = 0;
         }
         else
            edit->line[lines][lpos++] = c;
         if( lines >= 49 || size > 4096 )
         {
            edit->line[lines][lpos] = '\0';
            break;
         }
      }


Chaneg to:
   if( data )
   {
      for( ;; )
      {
         c = data[size++];
         if( c == '\0' )
         {
            edit->line[lines][lpos] = '\0';
            break;
         }
         else if( c == '\r' );
         else if( c == '\n' || lpos > 79 )
         {
            edit->line[lines][lpos] = '\0';
            ++lines;
            lpos = 0;
         }
         else
            edit->line[lines][lpos++] = c;
         if( lines >= 49 || size > 4096 )
         {
            edit->line[lines][lpos] = '\0';
            break;
         }
      }
   }


editor.c, char *char_data::copy_buffer

Locate:
    if( hash )
      return STRALLOC( buf );


Change to:
   if( hash )
   {
      if( buf && buf[0] != '\0' )
         return STRALLOC( buf );
      return NULL;
   }


This is just a minor annoyance factor. The bug spam generated by it is just to inform you that the string hashing code tried to allocate an empty or null string. This is actually not harmful in any way, but enough empty strings in the hash eventually leads to false memory leak reports if using valgrind for debugging purposes.
       
Pages:<< prev 1 next >>