Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
By GatewaySysop
Bug in do_drag( )
Oct 8, 2017, 12:40 am
By GatewaySysop
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Beastmaster 6D sound files
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, DotBot, Sogou

Members: 0
Guests: 7
Stats
Files
Topics
Posts
Members
Newest Member
476
3,704
19,231
608
LAntorcha
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,639
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 >>