Re: [INFO][CODERS]

From: Thomas Arp (t_arp@stofanet.dk)
Date: 02/20/03


From: "Sam Ives" <xym@CABLESPEED.COM>
> One of the major things
> I have noticed is that the send_to_char functions are reveresed
> in bpl22
..and up. Circle 3.1 is the latest code available.

Also, SEND_TO_Q() no longer exists, and write_to_output has been
changed as well.

Variadic arguments are great, especially when dealing with output
functions, since (nearly) all boundary checking can be done in one
place, and it lets you get rid of some local buffers:

Instead of
<pre 3.0 bpl22 mailercode>
int i;
char buf[MAX_STRING_LENGTH];
size_t len, tlen, maxlen = sizeof(buf);
len = snprintf(buf, maxlen, "list of things:\r\n");
for (i=0;*list[i]!='\n' && len < maxlen;i++) {
  tlen = snprintf(buf+len, maxlen-len, "%s\r\n", list[i]);
  if (tlen < 0)
    break;
  len += tlen;
}

send_to_char(buf, ch);
</pre 3.0 bpl22 mailercode>

You can use

<3.0 bpl22, 3.1 mailercode>

int i;

send_to_char(ch, "list of things:\r\n");
for (i=0;*list[i]!='\n';i++)
  send_to_char(ch, "%s\r\n", list[i]);

</3.0 bpl22, 3.1 mailercode>

If you have a descriptior instead, just substitute
"send_to_char(ch," with "write_to_output(d,"

Making write_to_output(), send_to_char() and log() variadic functions
was a pure stroke of genious, to say the least. Ok, it makes most of
the snippets and patches incompatible, but the benefits outweigh the
problems thousandfold.

Welcor

--
   +---------------------------------------------------------------+
   | 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/26/03 PDT