Re: Problems with arcane portal

From: Daniel A. Koepke (dkoepke@circlemud.org)
Date: 06/21/02


On Sat, 22 Jun 2002, Torgny Bjers wrote:

> Isn't:
> send_to_char(ch, buf);
>
> Supposed to be:
> send_to_char(buf, ch);
>
> Or did the send_to_char get switched around recently?

It was switched for variable argument support in bpl21.  This was part of
a general effort (by George) to clean up buffering in CircleMUD.  Note
that the formerly common idiom

  /* For pre-bpl21.  buf is global, a, b, c are locals. */
  sprintf(buf, "%s %d %d\r\n", a, b, c);
  send_to_char(buf, ch);

was undesirable both for its use of a global buffer and the failure to
check for overflow.  With the change, send_to_char() is both safer
(because the buffer handling is internal and checked with snprintf()) and
more convenient:

  /* bpl21 and up. */
  send_to_char(ch, "%s %d %d\r\n", a, b, c);


-dak

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