Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Jul 2001 20:47:15 +0300
From:      Peter Pentchev <roam@orbitel.bg>
To:        Sheldon Hearn <sheldonh@starjuice.net>
Cc:        freebsd-hackers@FreeBSD.org
Subject:   Re: Weird <stdarg.h> problem in 4.3-STABLE
Message-ID:  <20010718204715.C635@ringworld.oblivion.bg>
In-Reply-To: <11254.995477648@axl.seasidesoftware.co.za>; from sheldonh@starjuice.net on Wed, Jul 18, 2001 at 07:34:08PM %2B0200
References:  <11254.995477648@axl.seasidesoftware.co.za>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jul 18, 2001 at 07:34:08PM +0200, Sheldon Hearn wrote:
> 
> Hi folks,
> 
> I'm busy developing a libdaemon implementation and have come unstuck on
> a weird problem with functions using variable argument lists in FreeBSD
> 4.3-STABLE.
> 
> What I really want is a static inline void function declared in a header
> file and included in various source files, looking something like this:
> 
> static inline void
> xdaemonwarn(char *fmt, ...)
> {
> 	va_list ap;
> 
> 	va_start(ap, fmt);
> 	if (!daemon_quiet)
> 		warn(fmt, ap);
> 	va_end(ap);
> 
> 	return;
> }

Errrrrr.  Snipped the rest, since this code snippet contains
an important mistake.

warn() does not take a va_list as an argument.
Try using vwarn(fmt, ap) instead, and your function looks fine.

G'luck,
Peter

-- 
I've heard that this sentence is a rumor.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010718204715.C635>