07 Dec, 2011, arholly wrote in the 1st comment:
Votes: 0
Hello:
I'm wanting to use the buffer replacement snippet I found out here and went to plug it in and got this message:
act_wiz.c: At top level:
act_wiz.c:6790: warning: return type defaults to 'int'
act_wiz.c: In function 'MUDCMD':
act_wiz.c:6799: error: 'BUFFER' has no member named 'file'
act_wiz.c:6799: error: 'BUFFER' has no member named 'function'
act_wiz.c:6799: error: 'BUFFER' has no member named 'line'
act_wiz.c:6806: error: 'ch' undeclared (first use in this function)
act_wiz.c:6806: error: (Each undeclared identifier is reported only once
act_wiz.c:6806: error: for each function it appears in.)
act_wiz.c:6808: warning: 'return' with no value, in function returning non-void
make: *** [act_wiz.o] Error 1


And this is the code:
/*Find and display where buffers are stuck open (MUAHAHAHA!)
*Great Debugging tool, by Dazzle(Darien) of Sandstorm
*/
MUDCMD(do_trackbuffer)
{
BUFFER *output = new_buf();
BUFFER *count, *count_next;
int counter =0;

for(count = buffer_list; count; count = count_next)
{
count_next = count->next;
if(count != output)
BufPrintf(output,"Buffer Found:File: %s, Function: %s, Line: %d\n\r",count->file, count->function, count->line);
else
BufPrintf(output,"Buffer Found:File: Called by this function! (Ignore!)\n\r");
counter++;
}

BufPrintf(output,"%d buffers were found open.\n\r",counter);
page_to_char(buf_string(output), ch);
free_buf(output);
return;
}


This is the code it's calling, which I thought (following the directions in the snippet), I've replaced correctly.
BUFFER *__new_buf(const char *file, const char *function, int line)
{
BUFFER *buffer;

if (buf_free == NULL)
buffer = alloc_perm(sizeof(*buffer));
else
{
buffer = buf_free;
buf_free = buf_free->next;
}

buffer->next = NULL;
buffer->state = BUFFER_SAFE;
buffer->size = get_size(BASE_BUF);

/*For debugging purposes*/
buffer->file = str_dup(file);
buffer->function= str_dup(function);
buffer->line = line;

buffer->string = alloc_mem(buffer->size);
buffer->string[0] = '\0';
top_buffer++;
LINK_SINGLE(buffer, next, buffer_list);
VALIDATE(buffer);

return buffer;
}


Thanks in advance for your help.
Arholly
07 Dec, 2011, Rarva.Riendf wrote in the 2nd comment:
Votes: 0
The snippet does not define BUFFER structure, I looked at this snippet as well, but I did not have this new_buf function as well. I guess you will need to look for it in the codebase he used to have the missing puzzle pieces.
08 Dec, 2011, Omega wrote in the 3rd comment:
Votes: 0
This is a plugin snippet for Stock ROM24b6.

Essentially it updates the buffer system to make it possible to track any unclosed buffers allocated by new_buf()……. new_buf gets re-defined from a function to the definition to __new_buf() which auto-inputs the variables for file/function and line.

You can define file/function and line in the buffer structure (buf_type)by adding
char *file;
char *function;
int line;


MUDCMD is also defined as such.

#define MUDCMD(name) void name(CHAR_DATA *ch, char *argument)


If your having any issue's getting it working, please feel free to PM me, I help anyone who wants to install my snippets.
08 Dec, 2011, arholly wrote in the 4th comment:
Votes: 0
Alright, I sent you a PM with some more help I need.
0.0/4