Re: strdup or str_dup?

From: George Greer (greerga@circlemud.org)
Date: 03/10/99


On Wed, 10 Mar 1999, Acido wrote:

>But if staying up could mean corrupt data in eg. pfiles (can't remember in
>my head of save_char() calls str_dup() right now though.. it would be a
>pretty bad thing to stay up i figure.

I'm sure a NULL pointer str_dup is the least to worry about of what most
coders put into their MUDs.  Even stock CircleMUD has had about 3 memory
corruptions fixed since bpl12.

A NULL pointer str_dup() comes up so often in OasisOLC that it has its own
function now, str_udup().

char *str_udup(const char *txt)
{
  return str_dup((txt && *txt) ? txt : "undefined");
}

Because in OLC, the builder could leave a NULL pointer and some people
write MUD code that doesn't like NULL pointers.

--
George Greer            | The Ceramic Mouse & Snippets
greerga@circlemud.org   | http://mouse.van.m-l.org/


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST