George's Buffer patch 18

From: Torgny Bjers (artovil@arcanerealms.org)
Date: 03/24/02


Hello,

I am running a CircleMUD bpl18 with MySQL on a Linux machine.  I just
attempted to put in the Buffer patch by George, and I have it working as far
as booting and running.  I changed so that it runs solely on the new buffers
only, and then of course I get errors, but I have an error in a macro, and
since memory allocation/free'ing is not my strong side, I could use some
help to adapt these macros to the new buffers.

The link to the patch is:
http://www.circlemud.org/pub/CircleMUD/contrib/code/utils/buffer18.patch

Here are my defines that I get trouble with:
#define    SQL_MALLOC(source, dest) ((dest) = (char *)malloc( (source) ?
strlen((source)) * 2 + 1 : 1 ));\
    if(!(source)) strcpy((dest), " ");
#define    SQL_ESC(source, dest) if(source) mysql_escape_string(dest,
source, strlen(source)); else dest[0]='\0'
#define    SQL_FREE(string) if(string) free(string);

The errors reported are:
BUF: SYSERR: detach_buffer: No buffer->data 0x82608f0 found for do_help:233.

The code where the error is in do_help:

    if (*searcharg)
        SQL_FREE(searcharg);

If you need any help on the mysql_escape_string, you can find that in the
MySQL C API documentation at:
http://www.mysql.com/doc/C/C/C.html

I would appreciate any help on this, since I am a complete moron when it
comes to memory handling of course, and know nothing of these things that I
meddle in. :)

Kindest Regards,
/Torgny

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT