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

@ -6,6 +6,7 @@
*
*/
#include "libi3.h"
#include <math.h>
#include <stdlib.h>
#include <xcb/xcb_xrm.h>

View File

@ -6,6 +6,8 @@
* draw.c: Utility for drawing.
*
*/
#include "libi3.h"
#include <stdlib.h>
#include <err.h>
#include <string.h>
@ -13,8 +15,6 @@
#include <xcb/xcb_aux.h>
#include <cairo/cairo-xcb.h>
#include "libi3.h"
/* The default visual_type to use if none is specified when creating the surface. Must be defined globally. */
xcb_visualtype_t *visual_type;

View File

@ -5,14 +5,14 @@
* © 2009 Michael Stapelberg and contributors (see also: LICENSE)
*
*/
#include "libi3.h"
#include <stdlib.h>
#include <stdbool.h>
#include <xcb/xcb.h>
#include <xcb/xproto.h>
#include "libi3.h"
/*
* Generates a configure_notify event and sends it to the given window
* Applications need this to think theyve configured themselves correctly.

View File

@ -5,6 +5,8 @@
* © 2009 Michael Stapelberg and contributors (see also: LICENSE)
*
*/
#include "libi3.h"
#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
@ -15,8 +17,6 @@
#include <cairo/cairo-xcb.h>
#include <pango/pangocairo.h>
#include "libi3.h"
static const i3Font *savedFont = NULL;
static xcb_visualtype_t *root_visual_type;

View File

@ -5,12 +5,12 @@
* © 2009 Michael Stapelberg and contributors (see also: LICENSE)
*
*/
#include "libi3.h"
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include "libi3.h"
#ifndef STARTS_WITH
#define STARTS_WITH(string, needle) (strncasecmp((string), (needle), strlen((needle))) == 0)
#endif

View File

@ -5,13 +5,13 @@
* © 2009 Michael Stapelberg and contributors (see also: LICENSE)
*
*/
#include "libi3.h"
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include "queue.h"
#include "libi3.h"
struct Colorpixel {
char hex[8];
uint32_t pixel;

View File

@ -6,6 +6,7 @@
*
*/
#include "libi3.h"
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>

View File

@ -1,3 +1,12 @@
/*
* vim:ts=4:sw=4:expandtab
*
* i3 - an improved dynamic tiling window manager
* © 2009 Michael Stapelberg and contributors (see also: LICENSE)
*
*/
#include "libi3.h"
#include <unistd.h>
#include <string.h>
#include <stdio.h>
@ -5,8 +14,6 @@
#include <stdlib.h>
#include <errno.h>
#include "libi3.h"
/*
* This function returns the absolute path to the executable it is running in.
*

View File

@ -5,13 +5,13 @@
* © 2009 Michael Stapelberg and contributors (see also: LICENSE)
*
*/
#include "libi3.h"
#include <stdint.h>
#include <stdlib.h>
#include <xcb/xcb.h>
#include <xcb/xcb_keysyms.h>
#include "libi3.h"
/*
* All-in-one function which returns the modifier mask (XCB_MOD_MASK_*) for the
* given keysymbol, for example for XCB_NUM_LOCK (usually configured to mod2).

View File

@ -5,6 +5,8 @@
* © 2009 Michael Stapelberg and contributors (see also: LICENSE)
*
*/
#include "libi3.h"
#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
@ -17,8 +19,6 @@
#include <unistd.h>
#include <err.h>
#include "libi3.h"
/*
* Returns the name of a temporary file with the specified prefix.
*

View File

@ -5,6 +5,8 @@
* © 2009 Michael Stapelberg and contributors (see also: LICENSE)
*
*/
#include "libi3.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
@ -14,8 +16,6 @@
#include <unistd.h>
#include <fcntl.h>
#include "libi3.h"
/*
* Connects to the i3 IPC socket and returns the file descriptor for the
* socket. die()s if anything goes wrong.

View File

@ -5,6 +5,8 @@
* © 2009 Michael Stapelberg and contributors (see also: LICENSE)
*
*/
#include "libi3.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@ -14,8 +16,6 @@
#include <i3/ipc.h>
#include "libi3.h"
/*
* Reads a message from the given socket file descriptor and stores its length
* (reply_length) as well as a pointer to its contents (reply).

View File

@ -5,6 +5,8 @@
* © 2009 Michael Stapelberg and contributors (see also: LICENSE)
*
*/
#include "libi3.h"
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
@ -14,8 +16,6 @@
#include <i3/ipc.h>
#include "libi3.h"
/*
* Formats a message (payload) of the given size and type and sends it to i3 via
* the given socket file descriptor.

View File

@ -1,3 +1,12 @@
/*
* vim:ts=4:sw=4:expandtab
*
* i3 - an improved dynamic tiling window manager
* © 2009 Michael Stapelberg and contributors (see also: LICENSE)
*
*/
#include "libi3.h"
#include <string.h>
#include <stdbool.h>

View File

@ -1,4 +1,12 @@
/*
* vim:ts=4:sw=4:expandtab
*
* i3 - an improved dynamic tiling window manager
* © 2009 Michael Stapelberg and contributors (see also: LICENSE)
*
*/
#include "libi3.h"
#include <errno.h>
#include <stdlib.h>
#include <string.h>

View File

@ -5,8 +5,8 @@
* © 2009 Michael Stapelberg and contributors (see also: LICENSE)
*
*/
#include "libi3.h"
#include <err.h>
#include <glob.h>
#include <stdlib.h>

View File

@ -5,6 +5,8 @@
* © 2009 Michael Stapelberg and contributors (see also: LICENSE)
*
*/
#include "libi3.h"
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
@ -15,8 +17,6 @@
#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
#include "libi3.h"
/*
* Try to get the contents of the given atom (for example I3_SOCKET_PATH) from
* the X11 root window and return NULL if it doesnt work.

View File

@ -5,6 +5,8 @@
* © 2009 Michael Stapelberg and contributors (see also: LICENSE)
*
*/
#include "libi3.h"
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
@ -13,8 +15,6 @@
#include <err.h>
#include <errno.h>
#include "libi3.h"
/*
* The s* functions (safe) are wrappers around malloc, strdup, …, which exits if one of
* the called functions returns NULL, meaning that there is no more memory available

View File

@ -9,14 +9,13 @@
* others want UTF-8 (Pango).
*
*/
#include "libi3.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include "libi3.h"
struct _i3String {
char *utf8;
xcb_char2b_t *ucs2;

View File

@ -5,11 +5,11 @@
* © 2009 Michael Stapelberg and contributors (see also: LICENSE)
*
*/
#include "libi3.h"
#include <sys/types.h>
#include <string.h>
#include "libi3.h"
#if defined(__APPLE__)
/*

View File

@ -5,14 +5,14 @@
* © 2009 Michael Stapelberg and contributors (see also: LICENSE)
*
*/
#include "libi3.h"
#include <err.h>
#include <errno.h>
#include <iconv.h>
#include <stdlib.h>
#include <string.h>
#include "libi3.h"
static iconv_t utf8_conversion_descriptor = (iconv_t)-1;
static iconv_t ucs2_conversion_descriptor = (iconv_t)-1;