tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Namespace pollution in strings.h



The strings.h header is posix defined and only allowed to export very
few user visible symbols.

We do not follow the standard here, the attache patch tries to fix
that - however, this will result in ~nobody finding/using the popcount*
functions.

What do you think?

Martin
Index: strings.h
===================================================================
RCS file: /cvsroot/src/include/strings.h,v
retrieving revision 1.18
diff -u -r1.18 strings.h
--- strings.h   22 Aug 2011 01:24:15 -0000      1.18
+++ strings.h   27 Apr 2013 17:50:23 -0000
@@ -54,11 +54,15 @@
 void    bzero(void *, size_t);
 int     ffs(int);
 char   *index(const char *, int);
+
+#if defined(_NETBSD_SOURCE)
 unsigned int   popcount(unsigned int) __constfunc;
 unsigned int   popcountl(unsigned long) __constfunc;
 unsigned int   popcountll(unsigned long long) __constfunc;
 unsigned int   popcount32(__uint32_t) __constfunc;
 unsigned int   popcount64(__uint64_t) __constfunc;
+#endif
+
 char   *rindex(const char *, int);
 int     strcasecmp(const char *, const char *);
 int     strncasecmp(const char *, const char *, size_t);


Home | Main Index | Thread Index | Old Index