[CLEANUP] remove many #include <types/xxx> from C files

It should be stated as a rule that a C file should never
include types/xxx.h when proto/xxx.h exists, as it gives
less exposure to declaration conflicts (one of which was
caught and fixed here) and it complicates the file headers
for nothing.

Only types/global.h, types/capture.h and types/polling.h
have been found to be valid includes from C files.
This commit is contained in:
Willy Tarreau 2008-07-15 00:22:45 +02:00
parent 284648e079
commit ec6c5df018
29 changed files with 15 additions and 91 deletions

View File

@ -3,7 +3,7 @@
This file contains definitions of log-related functions, structures, This file contains definitions of log-related functions, structures,
and macros. and macros.
Copyright (C) 2000-2006 Willy Tarreau - w@1wt.eu Copyright (C) 2000-2008 Willy Tarreau - w@1wt.eu
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public
@ -38,17 +38,17 @@ extern struct pool_head *pool2_requri;
* Displays the message on stderr with the date and pid. Overrides the quiet * Displays the message on stderr with the date and pid. Overrides the quiet
* mode during startup. * mode during startup.
*/ */
void Alert(char *fmt, ...); void Alert(const char *fmt, ...);
/* /*
* Displays the message on stderr with the date and pid. * Displays the message on stderr with the date and pid.
*/ */
void Warning(char *fmt, ...); void Warning(const char *fmt, ...);
/* /*
* Displays the message on <out> only if quiet mode is not set. * Displays the message on <out> only if quiet mode is not set.
*/ */
void qfprintf(FILE *out, char *fmt, ...); void qfprintf(FILE *out, const char *fmt, ...);
/* /*
* This function sends a syslog message to both log servers of a proxy, * This function sends a syslog message to both log servers of a proxy,
@ -56,7 +56,7 @@ void qfprintf(FILE *out, char *fmt, ...);
* It also tries not to waste too much time computing the message header. * It also tries not to waste too much time computing the message header.
* It doesn't care about errors nor does it report them. * It doesn't care about errors nor does it report them.
*/ */
void send_log(struct proxy *p, int level, char *message, ...); void send_log(struct proxy *p, int level, const char *message, ...);
/* /*
* send a log for the session when we have enough info about it * send a log for the session when we have enough info about it

View File

@ -20,10 +20,6 @@
#include <proto/acl.h> #include <proto/acl.h>
#include <types/acl.h>
#include <types/proxy.h>
#include <types/session.h>
/* List head of all known ACL keywords */ /* List head of all known ACL keywords */
static struct acl_kw_list acl_keywords = { static struct acl_kw_list acl_keywords = {
.list = LIST_HEAD_INIT(acl_keywords.list) .list = LIST_HEAD_INIT(acl_keywords.list)

View File

@ -21,11 +21,9 @@
#include <common/ticks.h> #include <common/ticks.h>
#include <common/time.h> #include <common/time.h>
#include <types/buffers.h>
#include <types/global.h> #include <types/global.h>
#include <types/proxy.h>
#include <types/server.h>
#include <proto/proxy.h>
#include <proto/task.h> #include <proto/task.h>
static struct task *appsess_refresh = NULL; static struct task *appsess_refresh = NULL;

View File

@ -25,13 +25,7 @@
#include <common/ticks.h> #include <common/ticks.h>
#include <common/time.h> #include <common/time.h>
#include <types/acl.h>
#include <types/buffers.h>
#include <types/global.h> #include <types/global.h>
#include <types/polling.h>
#include <types/proxy.h>
#include <types/server.h>
#include <types/session.h>
#include <proto/acl.h> #include <proto/acl.h>
#include <proto/backend.h> #include <proto/backend.h>

View File

@ -32,10 +32,7 @@
#include <types/capture.h> #include <types/capture.h>
#include <types/global.h> #include <types/global.h>
#include <types/httperr.h>
#include <types/polling.h> #include <types/polling.h>
#include <types/proxy.h>
#include <types/queue.h>
#include <proto/acl.h> #include <proto/acl.h>
#include <proto/backend.h> #include <proto/backend.h>

View File

@ -30,9 +30,6 @@
#include <common/time.h> #include <common/time.h>
#include <types/global.h> #include <types/global.h>
#include <types/polling.h>
#include <types/proxy.h>
#include <types/session.h>
#include <proto/backend.h> #include <proto/backend.h>
#include <proto/buffers.h> #include <proto/buffers.h>

View File

@ -24,15 +24,7 @@
#include <common/config.h> #include <common/config.h>
#include <common/time.h> #include <common/time.h>
#include <types/acl.h>
#include <types/backend.h>
#include <types/buffers.h>
#include <types/global.h> #include <types/global.h>
#include <types/httperr.h>
#include <types/polling.h>
#include <types/proxy.h>
#include <types/server.h>
#include <types/session.h>
#include <proto/acl.h> #include <proto/acl.h>
#include <proto/buffers.h> #include <proto/buffers.h>

View File

@ -2,7 +2,7 @@
* Functions for managing transparent proxying with CTTPROXY. * Functions for managing transparent proxying with CTTPROXY.
* This file should be compiled only if CTTPROXY is enabled. * This file should be compiled only if CTTPROXY is enabled.
* *
* Copyright 2000-2007 Willy Tarreau <w@1wt.eu> * Copyright 2000-2008 Willy Tarreau <w@1wt.eu>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -25,8 +25,6 @@
#include <common/config.h> #include <common/config.h>
#include <common/time.h> #include <common/time.h>
#include <types/global.h>
#include <import/ip_tproxy.h> #include <import/ip_tproxy.h>
/* /*

View File

@ -36,9 +36,6 @@
#include <common/version.h> #include <common/version.h>
#include <types/global.h> #include <types/global.h>
#include <types/polling.h>
#include <types/proxy.h>
#include <types/server.h>
#include <proto/backend.h> #include <proto/backend.h>
#include <proto/buffers.h> #include <proto/buffers.h>

View File

@ -24,7 +24,6 @@
#include <types/fd.h> #include <types/fd.h>
#include <types/global.h> #include <types/global.h>
#include <proto/fd.h>
#include <proto/task.h> #include <proto/task.h>
#if defined(USE_MY_EPOLL) #if defined(USE_MY_EPOLL)

View File

@ -27,7 +27,6 @@
#include <common/time.h> #include <common/time.h>
#include <common/tools.h> #include <common/tools.h>
#include <types/fd.h>
#include <types/global.h> #include <types/global.h>
#include <proto/fd.h> #include <proto/fd.h>

View File

@ -20,7 +20,6 @@
#include <common/ticks.h> #include <common/ticks.h>
#include <common/time.h> #include <common/time.h>
#include <types/fd.h>
#include <types/global.h> #include <types/global.h>
#include <proto/fd.h> #include <proto/fd.h>

View File

@ -19,7 +19,6 @@
#include <common/ticks.h> #include <common/ticks.h>
#include <common/time.h> #include <common/time.h>
#include <types/fd.h>
#include <types/global.h> #include <types/global.h>
#include <proto/fd.h> #include <proto/fd.h>

View File

@ -56,7 +56,6 @@
#include <common/time.h> #include <common/time.h>
#include <common/tools.h> #include <common/tools.h>
#include <types/fd.h>
#include <types/global.h> #include <types/global.h>
#include <proto/fd.h> #include <proto/fd.h>

View File

@ -1,7 +1,7 @@
/* /*
* File descriptors management functions. * File descriptors management functions.
* *
* Copyright 2000-2007 Willy Tarreau <w@1wt.eu> * Copyright 2000-2008 Willy Tarreau <w@1wt.eu>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -18,8 +18,7 @@
#include <common/compat.h> #include <common/compat.h>
#include <common/config.h> #include <common/config.h>
#include <types/fd.h> //#include <types/global.h>
#include <types/global.h>
#include <proto/fd.h> #include <proto/fd.h>

View File

@ -75,9 +75,7 @@
#include <types/capture.h> #include <types/capture.h>
#include <types/global.h> #include <types/global.h>
#include <types/httperr.h>
#include <types/polling.h> #include <types/polling.h>
#include <types/proto_http.h>
#include <proto/acl.h> #include <proto/acl.h>
#include <proto/backend.h> #include <proto/backend.h>

View File

@ -1,7 +1,7 @@
/* /*
* Header indexation functions. * Header indexation functions.
* *
* Copyright 2000-2006 Willy Tarreau <w@1wt.eu> * Copyright 2000-2008 Willy Tarreau <w@1wt.eu>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -11,7 +11,7 @@
*/ */
#include <common/config.h> #include <common/config.h>
#include <types/hdr_idx.h> #include <proto/hdr_idx.h>
/* /*

View File

@ -26,10 +26,9 @@
#include <common/standard.h> #include <common/standard.h>
#include <common/time.h> #include <common/time.h>
#include <types/backend.h>
#include <types/global.h> #include <types/global.h>
#include <types/log.h>
#include <types/session.h> #include <proto/log.h>
#ifndef MSG_NOSIGNAL #ifndef MSG_NOSIGNAL
#define MSG_NOSIGNAL (0) #define MSG_NOSIGNAL (0)

View File

@ -35,13 +35,8 @@
#include <common/uri_auth.h> #include <common/uri_auth.h>
#include <common/version.h> #include <common/version.h>
#include <types/acl.h>
#include <types/capture.h> #include <types/capture.h>
#include <types/global.h> #include <types/global.h>
#include <types/httperr.h>
#include <types/polling.h>
#include <types/proxy.h>
#include <types/server.h>
#include <proto/acl.h> #include <proto/acl.h>
#include <proto/backend.h> #include <proto/backend.h>

View File

@ -35,11 +35,7 @@
#include <common/time.h> #include <common/time.h>
#include <common/version.h> #include <common/version.h>
#include <types/acl.h>
#include <types/global.h> #include <types/global.h>
#include <types/polling.h>
#include <types/proxy.h>
#include <types/server.h>
#include <proto/acl.h> #include <proto/acl.h>
#include <proto/backend.h> #include <proto/backend.h>

View File

@ -36,12 +36,7 @@
#include <common/time.h> #include <common/time.h>
#include <common/version.h> #include <common/version.h>
#include <types/acl.h>
#include <types/capture.h>
#include <types/global.h> #include <types/global.h>
#include <types/polling.h>
#include <types/proxy.h>
#include <types/server.h>
#include <proto/acl.h> #include <proto/acl.h>
#include <proto/backend.h> #include <proto/backend.h>

View File

@ -1,7 +1,7 @@
/* /*
* Protocol registration functions. * Protocol registration functions.
* *
* Copyright 2000-2007 Willy Tarreau <w@1wt.eu> * Copyright 2000-2008 Willy Tarreau <w@1wt.eu>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -18,8 +18,6 @@
#include <common/mini-clist.h> #include <common/mini-clist.h>
#include <common/standard.h> #include <common/standard.h>
#include <types/protocols.h>
#include <proto/fd.h> #include <proto/fd.h>
/* List head of all registered protocols */ /* List head of all registered protocols */

View File

@ -26,7 +26,6 @@
#include <common/time.h> #include <common/time.h>
#include <types/global.h> #include <types/global.h>
#include <types/polling.h>
#include <proto/client.h> #include <proto/client.h>
#include <proto/backend.h> #include <proto/backend.h>

View File

@ -14,9 +14,6 @@
#include <common/memory.h> #include <common/memory.h>
#include <common/time.h> #include <common/time.h>
#include <types/proxy.h>
#include <types/session.h>
#include <proto/queue.h> #include <proto/queue.h>
#include <proto/server.h> #include <proto/server.h>
#include <proto/task.h> #include <proto/task.h>

View File

@ -32,11 +32,6 @@
#include <common/time.h> #include <common/time.h>
#include <common/version.h> #include <common/version.h>
#include <types/global.h>
#include <types/polling.h>
#include <types/proxy.h>
#include <types/server.h>
#include <proto/backend.h> #include <proto/backend.h>
#include <proto/buffers.h> #include <proto/buffers.h>
#include <proto/fd.h> #include <proto/fd.h>

View File

@ -14,9 +14,7 @@
#include <common/config.h> #include <common/config.h>
#include <common/time.h> #include <common/time.h>
#include <types/backend.h> #include <proto/server.h>
#include <types/proxy.h>
#include <types/server.h>
int srv_downtime(struct server *s) { int srv_downtime(struct server *s) {

View File

@ -16,11 +16,7 @@
#include <common/debug.h> #include <common/debug.h>
#include <common/memory.h> #include <common/memory.h>
#include <types/backend.h>
#include <types/capture.h> #include <types/capture.h>
#include <types/log.h>
#include <types/proxy.h>
#include <types/server.h>
#include <proto/buffers.h> #include <proto/buffers.h>
#include <proto/hdr_idx.h> #include <proto/hdr_idx.h>

View File

@ -26,10 +26,6 @@
#include <common/ticks.h> #include <common/ticks.h>
#include <common/time.h> #include <common/time.h>
#include <types/buffers.h>
#include <types/global.h>
#include <types/polling.h>
#include <proto/client.h> #include <proto/client.h>
#include <proto/fd.h> #include <proto/fd.h>
#include <proto/stream_sock.h> #include <proto/stream_sock.h>

View File

@ -19,7 +19,6 @@
#include <proto/proxy.h> #include <proto/proxy.h>
#include <proto/task.h> #include <proto/task.h>
#include <types/task.h>
struct pool_head *pool2_task; struct pool_head *pool2_task;