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;
}
/* buffer procedures */
#define new_buf() __new_buf(__FILE__, __FUNCTION__, __LINE__)
BUFFER *__new_buf args( (const char *file, const char *function, int line) );
void BufPrintf args(( BUFFER * buffer, char * fmt, … ));
BUFFER *new_buf_size args( (int size) );
void free_buf args( (BUFFER *buffer) );
bool add_buf args( (BUFFER *buffer, char *string) );
void clear_buf args( (BUFFER *buffer) );
char *buf_string args( (BUFFER *buffer) );
struct buf_type
{
BUFFER * next;
bool valid;
sh_int state; /* error state of the buffer */
sh_int size; /* size in k */
char * file; //here <–
char * function; //here <–
sh_int line; //here <–
char * string; /* buffer's string */
};
struct buf_type
{
BUFFER * next;
sh_int state; /* error state of the buffer */
sh_int size; /* size in k */
sh_int line; //here <–
char * string; /* buffer's string */
char * file; //here <–
char * function; //here <–
bool valid;
};
struct buf_type
{
BUFFER * next;
sh_int state; /* error state of the buffer */
sh_int size; /* size in k */
sh_int line; //here <–
char * string; /* buffer's string */
char * file; //here <–
char * function; //here <–
bool valid;
};
struct buf_type
{
BUFFER * next;
char * string; /* buffer's string */
char * file; //here <–
char * function; //here <–
sh_int state; /* error state of the buffer */
sh_int size; /* size in k */
sh_int line; //here <–
bool valid;
};
Im having problems getting dariens buffer additions into a friends code. Heres the deal. I host with arthmoor who uses gcc 4.1.2x
Im running a modified ANSR and so is my friend, though he is hosted on a centos 4.4 server with gcc 3.3.6
I got this working in mine a while back no problems, works perfect etc.
I try it in my friends and it keeps giving me the error: structure has no member named function, file, line.
I have the define :
BUFFER *__new_buf args( (const char *file, const char *function, int line) );
#define new_buf() __new_buf(__FILE__, __FUNCTION__, __LINE__)
void BufPrintf args(( BUFFER * buffer, char * fmt, … ));
which again worked fine on my code.
what is added to new_buf is:
BUFFER *__new_buf(const char *file, const char *function, int line)
Now inside of the __new_buf function, after buffer->size = get_size(BASE_BUF);
put in the following.
/*For debugging purposes*/
buffer->file = str_dup(file);
buffer->function= str_dup(function);
buffer->line = line;
otherwise its the same, and the only problems arise from the new aditions. I of course did a full make, but no go.
It just refuses to see the define that adds those 3 items. Im kind of lost at this point. Could it be a gcc issue (as its older)?
-Syn