Reduce windows header includes in our own headers.

It turns out that absolutely everything that was including
windows.h was doing so needlessly; our headers don't need it,
so we should just include winsock2.h (since that's where
struct timeval is defined).

Pre-2.0 code will use the old headers, which include windows.h
for them, so we aren't breaking source compatibility with 1.4.

This solves the bug where we were leaving WIN32_LEAN_AND_MEAN
defined, in roughly the same way that buying an automobile
solves the question of what to give your coachman for boxing
day.
This commit is contained in:
Nick Mathewson 2010-02-03 02:09:19 -05:00
parent 27c9a40f15
commit da6135e356
10 changed files with 6 additions and 51 deletions

View File

@ -101,7 +101,9 @@
#ifdef WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#ifndef _WIN32_IE
#define _WIN32_IE 0x400
#endif
#include <shlobj.h>
#endif

View File

@ -65,13 +65,6 @@ extern "C" {
/* For int types. */
#include <event2/util.h>
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#endif
/* Just for error reporting - use other constants otherwise */
#define BEV_EVENT_READING 0x01 /**< error encountered while reading */
#define BEV_EVENT_WRITING 0x02 /**< error encountered while writing */

View File

@ -51,12 +51,6 @@ extern "C" {
/* For struct event */
#include <event2/event_struct.h>
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#endif
struct event_watermark {
size_t low;
size_t high;

View File

@ -50,12 +50,6 @@ extern "C" {
/* For int types. */
#include <event2/util.h>
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#endif
struct event_base;
struct event;
struct event_config;

View File

@ -49,12 +49,6 @@ extern "C" {
/* For int types. */
#include <event2/util.h>
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#endif
/**
Initialize the event API.

View File

@ -49,13 +49,6 @@ extern "C" {
/* For int types. */
#include <event2/util.h>
#ifdef WIN32
#include <winsock2.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#endif
#define EVLIST_TIMEOUT 0x01
#define EVLIST_INSERTED 0x02
#define EVLIST_SIGNAL 0x04

View File

@ -34,13 +34,6 @@
extern "C" {
#endif
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#endif
/* In case we haven't included the right headers yet. */
struct evbuffer;
struct event_base;

View File

@ -49,12 +49,6 @@ extern "C" {
/* For int types. */
#include <event2/util.h>
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#endif
/**
* Start an HTTP server on the specified address and port
*

View File

@ -48,12 +48,6 @@ extern "C" {
/* For int types. */
#include <event2/util.h>
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#endif
struct evbuffer;
/*

View File

@ -63,6 +63,10 @@ extern "C" {
#include <netdb.h>
#endif
#ifdef WIN32
#include <winsock2.h>
#endif
/* Integer type definitions for types that are supposed to be defined in the
* C99-specified stdint.h. Shamefully, some platforms do not include
* stdint.h, so we need to replace it. (If you are on a platform like this,