svn commit: trunk/uClibc/libc/misc/syslog

Bernhard Fischer rep.dot.nop at gmail.com
Tue Jun 3 14:33:55 UTC 2008


On Tue, Jun 03, 2008 at 07:26:13AM -0700, vda at uclibc.org wrote:
>Author: vda
>Date: 2008-06-03 07:26:12 -0700 (Tue, 03 Jun 2008)
>New Revision: 22201

>-static int	LogFile = -1;		/* fd for log */
>-static smalluint connected;		/* have done connect */
>-static int	LogStat = 0;		/* status bits, set by openlog() */
>-static const char *LogTag = "syslog";	/* string to tag the entry with */
>-static int	LogFacility = LOG_USER;	/* default facility code */
>-static int	LogMask = 0xff;		/* mask of priorities to be logged */
>-static struct sockaddr SyslogAddr;	/* AF_UNIX address of local logger */
>+static int       LogFile = -1;          /* fd for log */
>+static smalluint connected;             /* have done connect */
>+/* all bits in option argument for openlog() fit in 8 bits */
>+static smalluint LogStat = 0;           /* status bits, set by openlog() */
>+static const char *LogTag = "syslog";   /* string to tag the entry with */
>+/* this fits in 8 bits too (LOG_LOCAL7 = 23<<3 = 184),
>+ * but NB: LOG_FACMASK is bigger (= 0x03f8 = 127<<3) for some strange reason.
>+ * Oh well. */
>+static int       LogFacility = LOG_USER;/* default facility code */
>+/* bits mask of priorities (eight prios - 8 bits is enough) */
>+static smalluint LogMask = 0xff;        /* mask of priorities to be logged */

can't we just use different masks and just use one (let's say)
static unsigned int _state;

Even if this would not proove benefical in this very spot, there are
quite some functions that can be shrinked by just masking several
smaller state-vars (each only using a ver few bits) into one.

Comments?



More information about the uClibc mailing list