Re: [Question] act.other.c - do_gen_tog

From: Crimson Wizard (cwizard@GIBLETS.COM)
Date: 07/15/97


On Tue, 15 Jul 1997, George wrote:

> On Tue, 15 Jul 1997, Crimson Wizard wrote:
>
> >    if (PRF_TOG_CHK(ch, PRF_NOHASSLE) == 0) {
> >      if (GET_PROMPT(ch))
> >        free(GET_PROMPT(ch));
> >        GET_PROMPT(ch) = "&G<Z:%z R:%r I:%i>&n";
> >    } else {
> >      if (GET_PROMPT(ch))
> >        free(GET_PROMPT(ch));
> >        GET_PROMPT(ch) = "Regular Player Prompt (testing):";
>
> Trying to free a string constant is evil, which is what your code will end
> up doing (or at least trying).  Try str_dup().

I love you :)

I was using free() because it was being used elsewhere in the stock code..
str_dup() works great.

--
#!/bin/sh
whois yea.com|grep YEA2|awk '{print $1}'
whois aree.com|grep DOM|awk '{print $1}'
whois aree.com|grep DOM|awk '{print $1}'|cut -c1
whois tm920|grep TM920|awk '{print $4}'|cut -d@ -f1


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



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