Skip to content

Commit

Permalink
Got rid of a bunch of ifdefs for vasprintf
Browse files Browse the repository at this point in the history
  • Loading branch information
dustin committed Apr 26, 2009
1 parent f59b3c0 commit 4c70e4c
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions commands/sd_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,30 +493,18 @@ static int
writeToClient(struct client *client, const char *fmt, ...)
{
va_list ap;
#ifdef HAVE_VASPRINTF
char *aptr;
#else
char buf[CLIENT_BUF_SIZE];
#endif
int toWrite=0;
struct client_msg *newmsg, *lastmsg;

va_start(ap, fmt);
#ifdef HAVE_VASPRINTF
toWrite=vasprintf(&aptr, fmt, ap);
#else
toWrite=vsnprintf(buf, CLIENT_BUF_SIZE, fmt, ap);
assert(toWrite < CLIENT_BUF_SIZE);
#endif
va_end(ap);

/* OK, now append that to the messages list */
newmsg=calloc(1, sizeof(struct client_msg));
#ifdef HAVE_VASPRINTF
newmsg->data=aptr;
#else
newmsg->data=strdup(buf);
#endif
newmsg->offset=0;
newmsg->toWrite=toWrite;

Expand Down

0 comments on commit 4c70e4c

Please sign in to comment.