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

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "assignments.c"
/*
* vim:ts=4:sw=4:expandtab
*

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "click.c"
/*
* vim:ts=4:sw=4:expandtab
*

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "commands.c"
/*
* vim:ts=4:sw=4:expandtab
*
@ -9,6 +7,8 @@
* commands.c: all command functions (see commands_parser.c)
*
*/
#include "all.h"
#include <stdint.h>
#include <float.h>
#include <stdarg.h>
@ -17,7 +17,6 @@
#include <sanitizer/lsan_interface.h>
#endif
#include "all.h"
#include "shmlog.h"
// Macros to make the YAJL API a bit easier to use.

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "commands_parser.c"
/*
* vim:ts=4:sw=4:expandtab
*
@ -25,6 +23,8 @@
* instead of actually calling any function).
*
*/
#include "all.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -32,8 +32,6 @@
#include <stdbool.h>
#include <stdint.h>
#include "all.h"
// Macros to make the YAJL API a bit easier to use.
#define y(x, ...) (command_output.json_gen != NULL ? yajl_gen_##x(command_output.json_gen, ##__VA_ARGS__) : 0)
#define ystr(str) (command_output.json_gen != NULL ? yajl_gen_string(command_output.json_gen, (unsigned char *)str, strlen(str)) : 0)

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "con.c"
/*
* vim:ts=4:sw=4:expandtab
*
@ -12,6 +10,7 @@
*
*/
#include "all.h"
#include "yajl_utils.h"
static void con_on_remove_child(Con *con);

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "config.c"
/*
* vim:ts=4:sw=4:expandtab
*
@ -11,6 +9,7 @@
*
*/
#include "all.h"
#include <xkbcommon/xkbcommon.h>
char *current_configpath = NULL;

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "config_directives.c"
/*
* vim:ts=4:sw=4:expandtab
*
@ -9,11 +7,11 @@
* config_directives.c: all config storing functions (see config_parser.c)
*
*/
#include "all.h"
#include <float.h>
#include <stdarg.h>
#include "all.h"
/*******************************************************************************
* Criteria functions.
******************************************************************************/

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "config_parser.c"
/*
* vim:ts=4:sw=4:expandtab
*
@ -25,6 +23,8 @@
* nearest <error> token.
*
*/
#include "all.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -37,8 +37,6 @@
#include <fcntl.h>
#include <xcb/xcb_xrm.h>
#include "all.h"
// Macros to make the YAJL API a bit easier to use.
#define y(x, ...) yajl_gen_##x(command_output.json_gen, ##__VA_ARGS__)
#define ystr(str) yajl_gen_string(command_output.json_gen, (unsigned char *)str, strlen(str))

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "debug.c"
/*
* vim:ts=4:sw=4:expandtab
*
@ -10,6 +8,8 @@
* events. This code is from xcb-util.
*
*/
#include <config.h>
#include <stdio.h>
#include <xcb/xcb.h>

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "key_press.c"
/*
* vim:ts=4:sw=4:expandtab
*
@ -10,6 +8,8 @@
* i3 --moreversion.
*
*/
#include "all.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
@ -17,7 +17,6 @@
#include <sys/un.h>
#include <fcntl.h>
#include <time.h>
#include "all.h"
static bool human_readable_key, loaded_config_file_name_key;
static char *human_readable_version, *loaded_config_file_name;

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "ewmh.c"
/*
* vim:ts=4:sw=4:expandtab
*

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "fake_outputs.c"
/*
* vim:ts=4:sw=4:expandtab
*

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "floating.c"
/*
* vim:ts=4:sw=4:expandtab
*

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "handlers.c"
/*
* vim:ts=4:sw=4:expandtab
*

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "ipc.c"
/*
* vim:ts=4:sw=4:expandtab
*
@ -10,6 +8,7 @@
*
*/
#include "all.h"
#include "yajl_utils.h"
#include <stdint.h>

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "key_press.c"
/*
* vim:ts=4:sw=4:expandtab
*

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "load_layout.c"
/*
* vim:ts=4:sw=4:expandtab
*

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "log.c"
/*
* vim:ts=4:sw=4:expandtab
*
@ -9,6 +7,8 @@
* log.c: Logging functions.
*
*/
#include <config.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "main.c"
/*
* vim:ts=4:sw=4:expandtab
*
@ -9,6 +7,8 @@
* main.c: Initialization, main loop
*
*/
#include "all.h"
#include <ev.h>
#include <fcntl.h>
#include <sys/types.h>
@ -19,7 +19,6 @@
#include <sys/mman.h>
#include <sys/stat.h>
#include <libgen.h>
#include "all.h"
#include "shmlog.h"
#include "sd-daemon.h"

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "manage.c"
/*
* vim:ts=4:sw=4:expandtab
*
@ -10,6 +8,7 @@
*
*/
#include "all.h"
#include "yajl_utils.h"
#include <yajl/yajl_gen.h>

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "match.c"
/*
* vim:ts=4:sw=4:expandtab
*

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "move.c"
/*
* vim:ts=4:sw=4:expandtab
*

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "output.c"
/*
* vim:ts=4:sw=4:expandtab
*

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "randr.c"
/*
* vim:ts=4:sw=4:expandtab
*

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "regex.c"
/*
* vim:ts=4:sw=4:expandtab
*

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "render.c"
/*
* vim:ts=4:sw=4:expandtab
*

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "resize.c"
/*
* vim:ts=4:sw=4:expandtab
*

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "restore_layout.c"
/*
* vim:ts=4:sw=4:expandtab
*

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "scratchpad.c"
/*
* vim:ts=4:sw=4:expandtab
*

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "sighandler.c"
/*
* vim:ts=4:sw=4:expandtab
*

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "startup.c"
/*
* vim:ts=4:sw=4:expandtab
*
@ -13,6 +11,7 @@
*
*/
#include "all.h"
#include "sd-daemon.h"
#include <sys/types.h>

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "tree.c"
/*
* vim:ts=4:sw=4:expandtab
*

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "util.c"
/*
* vim:ts=4:sw=4:expandtab
*

View File

@ -8,4 +8,6 @@
* and used dynamically without recompiling every object file.
*
*/
#include <config.h>
const char *i3_version = I3_VERSION;

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "window.c"
/*
* vim:ts=4:sw=4:expandtab
*

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "workspace.c"
/*
* vim:ts=4:sw=4:expandtab
*

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "x.c"
/*
* vim:ts=4:sw=4:expandtab
*

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "xcb.c"
/*
* vim:ts=4:sw=4:expandtab
*

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "xcursor.c"
/*
* vim:ts=4:sw=4:expandtab
*
@ -9,6 +7,8 @@
* xcursor.c: xcursor support for themed cursors.
*
*/
#include <config.h>
#include <assert.h>
#include <xcb/xcb_cursor.h>

View File

@ -1,5 +1,3 @@
#undef I3__FILE__
#define I3__FILE__ "xinerama.c"
/*
* vim:ts=4:sw=4:expandtab
*