Ensure all *.[ch] files include config.h

Including config.h is necessary to get e.g. the _GNU_SOURCE define and
any other definitions that autoconf declares. Hence, config.h needs to
be included as the first header in each file.

This is done either via:
1. Including "common.h" (i3bar)
2. Including "libi3.h"
3. Including "all.h" (i3)
4. Including <config.h> directly

Also remove now-unused I3__FILE__, add copyright/license statement
where missing and switch include/all.h to #pragma once.
This commit is contained in:
Michael Stapelberg
2016-10-11 09:13:35 +02:00
parent c2bd10c482
commit f354f53435
134 changed files with 230 additions and 149 deletions

View File

@ -7,6 +7,8 @@
* child.c: Getting input for the statusline
*
*/
#include "common.h"
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
@ -25,8 +27,6 @@
#include <yajl/yajl_gen.h>
#include <paths.h>
#include "common.h"
/* Global variables for child_*() */
i3bar_child child;

View File

@ -7,6 +7,8 @@
* config.c: Parses the configuration (received from i3).
*
*/
#include "common.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@ -17,8 +19,6 @@
#include <X11/Xlib.h>
#include "common.h"
static char *cur_key;
static bool parsing_bindings;
static bool parsing_tray_outputs;

View File

@ -7,6 +7,8 @@
* ipc.c: Communicating with i3
*
*/
#include "common.h"
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
@ -21,8 +23,6 @@
#include <sanitizer/lsan_interface.h>
#endif
#include "common.h"
ev_io *i3_connection;
const char *sock_path;

View File

@ -5,6 +5,8 @@
* © 2010 Axel Wagner and contributors (see also: LICENSE)
*
*/
#include "common.h"
#include <stdio.h>
#include <i3/ipc.h>
#include <string.h>
@ -15,8 +17,6 @@
#include <getopt.h>
#include <glob.h>
#include "common.h"
/*
* Having verboselog(), errorlog() and debuglog() is necessary when using libi3.
*

View File

@ -7,6 +7,8 @@
* mode.c: Handle mode event and show current binding mode in the bar
*
*/
#include "common.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@ -14,8 +16,6 @@
#include <yajl/yajl_parse.h>
#include <yajl/yajl_version.h>
#include "common.h"
/* A datatype to pass through the callbacks to save the state */
struct mode_json_params {
char *json;

View File

@ -7,6 +7,8 @@
* outputs.c: Maintaining the outputs list
*
*/
#include "common.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@ -15,8 +17,6 @@
#include <yajl/yajl_parse.h>
#include <yajl/yajl_version.h>
#include "common.h"
/* A datatype to pass through the callbacks to save the state */
struct outputs_json_params {
struct outputs_head *outputs;

View File

@ -8,6 +8,8 @@
* protocol version and features.
*
*/
#include "common.h"
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
@ -25,8 +27,6 @@
#include <yajl/yajl_parse.h>
#include <yajl/yajl_version.h>
#include "common.h"
static enum {
KEY_VERSION,
KEY_STOP_SIGNAL,

View File

@ -7,6 +7,8 @@
* workspaces.c: Maintaining the workspace lists
*
*/
#include "common.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@ -14,8 +16,6 @@
#include <yajl/yajl_parse.h>
#include <yajl/yajl_version.h>
#include "common.h"
/* A datatype to pass through the callbacks to save the state */
struct workspaces_json_params {
struct ws_head *workspaces;

View File

@ -7,6 +7,8 @@
* xcb.c: Communicating with X
*
*/
#include "common.h"
#include <xcb/xcb.h>
#include <xcb/xkb.h>
#include <xcb/xproto.h>
@ -32,7 +34,6 @@
#include <sanitizer/lsan_interface.h>
#endif
#include "common.h"
#include "libi3.h"
/** This is the equivalent of XC_left_ptr. Im not sure why xcb doesnt have a