Wireshark-bugs: [Wireshark-bugs] [Bug 3161] text2pcap.c define trickery breaks strdup() handling
Date: Tue, 18 May 2010 12:49:13 -0700 (PDT)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3161

--- Comment #19 from Guy Harris <guy@xxxxxxxxxxxx> 2010-05-18 12:49:11 PDT ---
Windows shouldn't matter here - the #define trickery:

/*
 * Just make sure we include the prototype for strptime as well
 * (needed for glibc 2.2) but make sure we do this only if not
 * yet defined.
 */
#ifndef __USE_XOPEN
#  define __USE_XOPEN
#endif
#ifndef _XOPEN_SOURCE
#  define _XOPEN_SOURCE
#endif

/*
 * Defining _XOPEN_SOURCE is needed on some platforms, e.g. platforms
 * using glibc, to expand the set of things system header files define.
 * 
 * Unfortunately, on other platforms, such as some versions of Solaris
 * (including Solaris 10), it *reduces* that set as well, causing
 * strptime() not to be declared, presumably because the version of the
 * X/Open spec that _XOPEN_SOURCE implies doesn't include strptime() and
 * blah blah blah namespace pollution blah blah blah.
 * 
 * So we define __EXTENSIONS__ so that "strptime()" is declared. 
 */
#ifndef __EXTENSIONS__
#  define __EXTENSIONS__
#endif

is there to attempt to get a "give me the whole damn namespace" build option
for UN*Xes - Windows' Win32 environment doesn't claim to be POSIX-compliant so
the only standards namespace issues are "strict C89 namespace" vs. "we don't
protect the namespace".

Wireshark is, I think, neither "a POSIX-conforming application" nor "an
XSI-conforming application", as it requires interfaces other than those
published by POSIX or XSI (or the Single UNIX Specification).  It's our job to
avoid using stuff put into the name space by any of the extensions we use.

The way you request "give me the whole damn namespace" might be
platform-dependent; it appears you define _DARWIN_C_SOURCE in OS X, but I'm not
sure how you do it in Linux+glibc, *BSD for various values of *, Solaris,
HP-UX, AIX, etc.

-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.