Re: [NEWBIE] Examine X.corpse problem.

From: Dan Merillat (harik@chaos.ao.net)
Date: 04/02/00


Juliano Ravasi Ferraz writes:

>   char arg2[MAX_INPUT_LENGTH]; /* at beginning of the function */
>   strcpy(arg2, arg);
>   look_at_target(ch, arg2);
>
> That is an frustrated attempt to enhance this old idea. Living and
> learning... Excuse-me for my error, and thanks to all for this warning.

If your libc has it, try strdupa() rather then strdup... it's automatically
free()'d when your function returns, and is cheaper (cpu-wise) then malloc
(which strdup() uses).

It's fairly common now, at least in unix.  (most muds are running on
freebie/linux systems, and they both have it.)

--Dan


     +------------------------------------------------------------+
     | 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 : 04/10/01 PDT