Re: str_cmp / strcasecmp

From: George Greer (greerga@circlemud.org)
Date: 02/18/02


On Sun, 17 Feb 2002, Daniel A. Koepke wrote:

>> I also made str_dup only exist if strdup doesn't.
>
>I don't think this is a good idea.  Part of the point of str_dup() is
>that it uses CircleMUD's memory management and thus exits with a
>descriptive malloc() failure error rather than simply returning NULL and
>crashing.

It also obscures memory leak tracking and doesn't take into account any
possible architecture optimizations.  We could wrap it up in:

  char *str_dup(const char *dupme)
  {
    char *tmp;

    if (!(tmp = strdup(dupme)))
      print_message_and_die;

    return tmp;
  }

but a MUD should be one of the first things to die if a machine is really
running out of memory. Much better than killing inetd or sshd.

--
George Greer
greerga@circlemud.org

--
   +---------------------------------------------------------------+
   | 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