i3 - improved tiling WM


Use #pragma once

Patch status: merged

Patch by Alexander Kedrik

Long description:

 #pragma once is safer and simpler. According to Wikipedia it's supported by all major compilers.

To apply this patch, use:
curl http://cr.i3wm.org/patch/356/raw.patch | git am

b/i3-config-wizard/xcb.h

77
@@ -1,5 +1,4 @@
78
-#ifndef I3_XCB_H
79
-#define I3_XCB_H
80
+#pragma once
81
 
82
 /* from X11/keysymdef.h */
83
 #define XCB_NUM_LOCK                    0xff7f
84
@@ -7,5 +6,3 @@
85
 #define xmacro(atom) xcb_atom_t A_ ## atom;
86
 #include "atoms.xmacro"
87
 #undef xmacro
88
-
89
-#endif

b/i3-input/i3-input.h

94
@@ -1,5 +1,4 @@
95
-#ifndef I3_INPUT
96
-#define I3_INPUT
97
+#pragma once
98
 
99
 #include <err.h>
100
 
101
@@ -13,5 +12,3 @@
102
 while (0)
103
 
104
 extern xcb_window_t root;
105
-
106
-#endif

b/i3-nagbar/i3-nagbar.h

111
@@ -1,5 +1,4 @@
112
-#ifndef I3_NAGBAR
113
-#define I3_NAGBAR
114
+#pragma once
115
 
116
 #include <err.h>
117
 
118
@@ -17,5 +16,3 @@ while (0)
119
 #undef xmacro
120
 
121
 extern xcb_window_t root;
122
-
123
-#endif

b/i3bar/include/child.h

128
@@ -7,8 +7,7 @@
129
  * child.c: Getting Input for the statusline
130
  *
131
  */
132
-#ifndef CHILD_H_
133
-#define CHILD_H_
134
+#pragma once
135
 
136
 #include <stdbool.h>
137
 
138
@@ -79,5 +78,3 @@ void cont_child(void);
139
  *
140
  */
141
 void send_block_clicked(int button, const char *name, const char *instance, int x, int y);
142
-
143
-#endif

b/i3bar/include/common.h

148
@@ -5,8 +5,7 @@
149
  * © 2010-2011 Axel Wagner and contributors (see also: LICENSE)
150
  *
151
  */
152
-#ifndef COMMON_H_
153
-#define COMMON_H_
154
+#pragma once
155
 
156
 #include <stdbool.h>
157
 #include <xcb/xcb.h>
158
@@ -74,5 +73,3 @@ TAILQ_HEAD(statusline_head, status_block) statusline_head;
159
 #include "config.h"
160
 #include "libi3.h"
161
 #include "parse_json_header.h"
162
-
163
-#endif

b/i3bar/include/config.h

168
@@ -7,8 +7,7 @@
169
  * config.c: Parses the configuration (received from i3).
170
  *
171
  */
172
-#ifndef CONFIG_H_
173
-#define CONFIG_H_
174
+#pragma once
175
 
176
 #include "common.h"
177
 
178
@@ -52,5 +51,3 @@ void parse_config_json(char *json);
179
  *
180
  */
181
 void free_colors(struct xcb_color_strings_t *colors);
182
-
183
-#endif

b/i3bar/include/ipc.h

188
@@ -7,8 +7,7 @@
189
  * ipc.c: Communicating with i3
190
  *
191
  */
192
-#ifndef IPC_H_
193
-#define IPC_H_
194
+#pragma once
195
 
196
 #include <stdint.h>
197
 
198
@@ -37,5 +36,3 @@ int i3_send_msg(uint32_t type, const char* payload);
199
  *
200
  */
201
 void subscribe_events(void);
202
-
203
-#endif

b/i3bar/include/mode.h

208
@@ -7,8 +7,7 @@
209
  * mode.c: Handle mode-event and show current binding mode in the bar
210
  *
211
  */
212
-#ifndef MODE_H_
213
-#define MODE_H_
214
+#pragma once
215
 
216
 #include <xcb/xproto.h>
217
 
218
@@ -27,5 +26,3 @@ typedef struct mode mode;
219
  *
220
  */
221
 void parse_mode_json(char *json);
222
-
223
-#endif

b/i3bar/include/outputs.h

228
@@ -7,8 +7,7 @@
229
  * outputs.c: Maintaining the output-list
230
  *
231
  */
232
-#ifndef OUTPUTS_H_
233
-#define OUTPUTS_H_
234
+#pragma once
235
 
236
 #include <xcb/xcb.h>
237
 
238
@@ -53,5 +52,3 @@ struct i3_output {
239
 
240
     SLIST_ENTRY(i3_output) slist; /* Pointer for the SLIST-Macro */
241
 };
242
-
243
-#endif

b/i3bar/include/parse_json_header.h

248
@@ -8,8 +8,7 @@
249
  *                      protocol version and features.
250
  *
251
  */
252
-#ifndef PARSE_JSON_HEADER_H_
253
-#define PARSE_JSON_HEADER_H_
254
+#pragma once
255
 
256
 #include <stdint.h>
257
 
258
@@ -22,5 +21,3 @@
259
  *
260
  */
261
 void parse_json_header(i3bar_child *child, const unsigned char *buffer, int length, unsigned int *consumed);
262
-
263
-#endif

b/i3bar/include/trayclients.h

268
@@ -5,8 +5,7 @@
269
  * © 2010-2011 Axel Wagner and contributors (see also: LICENSE)
270
  *
271
  */
272
-#ifndef TRAYCLIENT_H_
273
-#define TRAYCLIENT_H_
274
+#pragma once
275
 
276
 #include "common.h"
277
 
278
@@ -21,5 +20,3 @@ struct trayclient {
279
 
280
     TAILQ_ENTRY(trayclient) tailq;  /* Pointer for the TAILQ-Macro */
281
 };
282
-
283
-#endif

b/i3bar/include/util.h

288
@@ -5,8 +5,7 @@
289
  * © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE)
290
  *
291
  */
292
-#ifndef UTIL_H_
293
-#define UTIL_H_
294
+#pragma once
295
 
296
 #include "queue.h"
297
 
298
@@ -36,8 +35,6 @@
299
     } \
300
 } while (0)
301
 
302
-#endif
303
-
304
 /* Securely fee tail-queues */
305
 #define FREE_TAILQ(l, type) do { \
306
     type *walk = TAILQ_FIRST(l); \

b/i3bar/include/workspaces.h

311
@@ -7,8 +7,7 @@
312
  * workspaces.c: Maintaining the workspace-lists
313
  *
314
  */
315
-#ifndef WORKSPACES_H_
316
-#define WORKSPACES_H_
317
+#pragma once
318
 
319
 #include <xcb/xproto.h>
320
 
321
@@ -42,5 +41,3 @@ struct i3_ws {
322
 
323
     TAILQ_ENTRY(i3_ws) tailq;       /* Pointer for the TAILQ-Macro */
324
 };
325
-
326
-#endif

b/i3bar/include/xcb.h

331
@@ -7,8 +7,7 @@
332
  * xcb.c: Communicating with X
333
  *
334
  */
335
-#ifndef XCB_H_
336
-#define XCB_H_
337
+#pragma once
338
 
339
 #include <stdint.h>
340
 //#include "outputs.h"
341
@@ -133,5 +132,3 @@ void redraw_bars(void);
342
  *
343
  */
344
 void set_current_mode(struct mode *mode);
345
-
346
-#endif

b/include/assignments.h

351
@@ -7,8 +7,7 @@
352
  * assignments.c: Assignments for specific windows (for_window).
353
  *
354
  */
355
-#ifndef I3_ASSIGNMENTS_H
356
-#define I3_ASSIGNMENTS_H
357
+#pragma once
358
 
359
 /**
360
  * Checks the list of assignments for the given window and runs all matching
361
@@ -22,5 +21,3 @@ void run_assignments(i3Window *window);
362
  *
363
  */
364
 Assignment *assignment_for(i3Window *window, int type);
365
-
366
-#endif

b/include/click.h

371
@@ -7,8 +7,7 @@
372
  * click.c: Button press (mouse click) events.
373
  *
374
  */
375
-#ifndef I3_CLICK_H
376
-#define I3_CLICK_H
377
+#pragma once
378
 
379
 /**
380
  * The button press X callback. This function determines whether the floating
381
@@ -19,5 +18,3 @@
382
  *
383
  */
384
 int handle_button_press(xcb_button_press_event_t *event);
385
-
386
-#endif

b/include/cmdparse.h

391
@@ -7,9 +7,6 @@
392
  * cmdparse.y: the parser for commands you send to i3 (or bind on keys)
393
  *
394
  */
395
-#ifndef I3_CMDPARSE_H
396
-#define I3_CMDPARSE_H
397
+#pragma once
398
 
399
 char *parse_cmd(const char *new);
400
-
401
-#endif

b/include/commands.h

406
@@ -7,8 +7,7 @@
407
  * commands.c: all command functions (see commands_parser.c)
408
  *
409
  */
410
-#ifndef I3_COMMANDS_H
411
-#define I3_COMMANDS_H
412
+#pragma once
413
 
414
 #include "commands_parser.h"
415
 
416
@@ -288,5 +287,3 @@ void cmd_shmlog(I3_CMD, char *argument);
417
  *
418
  */
419
 void cmd_debuglog(I3_CMD, char *argument);
420
-
421
-#endif

b/include/commands_parser.h

426
@@ -7,8 +7,7 @@
427
  * commands.c: all command functions (see commands_parser.c)
428
  *
429
  */
430
-#ifndef I3_COMMANDS_PARSER_H
431
-#define I3_COMMANDS_PARSER_H
432
+#pragma once
433
 
434
 #include <yajl/yajl_gen.h>
435
 
436
@@ -35,5 +34,3 @@ struct CommandResult {
437
 };
438
 
439
 struct CommandResult *parse_command(const char *input);
440
-
441
-#endif

b/include/con.h

446
@@ -9,8 +9,7 @@
447
  *        …).
448
  *
449
  */
450
-#ifndef I3_CON_H
451
-#define I3_CON_H
452
+#pragma once
453
 
454
 /**
455
  * Create a new container (and attach it to the given parent, if not NULL).
456
@@ -340,5 +339,3 @@ void con_set_urgency(Con *con, bool urgent);
457
  *
458
  */
459
 char *con_get_tree_representation(Con *con);
460
-
461
-#endif

b/include/config.h

466
@@ -10,8 +10,7 @@
467
  * bindings mode).
468
  *
469
  */
470
-#ifndef I3_CONFIG_H
471
-#define I3_CONFIG_H
472
+#pragma once
473
 
474
 #include <stdbool.h>
475
 #include "queue.h"
476
@@ -357,5 +356,3 @@ Binding *get_binding(uint16_t modifiers, bool key_release, xcb_keycode_t keycode
477
  *
478
  */
479
 void kill_configerror_nagbar(bool wait_for_it);
480
-
481
-#endif

b/include/config_directives.h

486
@@ -7,8 +7,7 @@
487
  * config_directives.h: all config storing functions (see config_parser.c)
488
  *
489
  */
490
-#ifndef I3_CONFIG_DIRECTIVES_H
491
-#define I3_CONFIG_DIRECTIVES_H
492
+#pragma once
493
 
494
 #include "config_parser.h"
495
 
496
@@ -77,5 +76,3 @@ CFGFUN(bar_status_command, const char *command);
497
 CFGFUN(bar_binding_mode_indicator, const char *value);
498
 CFGFUN(bar_workspace_buttons, const char *value);
499
 CFGFUN(bar_finish);
500
-
501
-#endif

b/include/config_parser.h

506
@@ -7,8 +7,7 @@
507
  * config_parser.h: config parser-related definitions
508
  *
509
  */
510
-#ifndef I3_CONFIG_PARSER_H
511
-#define I3_CONFIG_PARSER_H
512
+#pragma once
513
 
514
 #include <yajl/yajl_gen.h>
515
 
516
@@ -37,5 +36,3 @@ struct ConfigResult *parse_config(const char *input, struct context *context);
517
  *
518
  */
519
 void parse_file(const char *f);
520
-
521
-#endif

b/include/data.h

526
@@ -7,8 +7,7 @@
527
  * include/data.h: This file defines all data structures used by i3
528
  *
529
  */
530
-#ifndef I3_DATA_H
531
-#define I3_DATA_H
532
+#pragma once
533
 
534
 #define SN_API_NOT_YET_FROZEN 1
535
 #include <libsn/sn-launcher.h>
536
@@ -595,5 +594,3 @@ struct Con {
537
     /* Depth of the container window */
538
     uint16_t depth;
539
 };
540
-
541
-#endif

b/include/debug.h

546
@@ -8,9 +8,6 @@
547
  *          events.  This code is from xcb-util.
548
  *
549
  */
550
-#ifndef I3_DEBUG_H
551
-#define I3_DEBUG_H
552
+#pragma once
553
 
554
 int handle_event(void *ignored, xcb_connection_t *c, xcb_generic_event_t *e);
555
-
556
-#endif

b/include/display_version.h

561
@@ -7,8 +7,7 @@
562
  * display_version.c: displays the running i3 version, runs as part of
563
  *                    i3 --moreversion.
564
  */
565
-#ifndef I3_DISPLAY_VERSION_H
566
-#define I3_DISPLAY_VERSION_H
567
+#pragma once
568
 
569
 /**
570
  * Connects to i3 to find out the currently running version. Useful since it
571
@@ -23,5 +22,3 @@
572
  *
573
  */
574
 void display_running_version(void);
575
-
576
-#endif

b/include/ewmh.h

581
@@ -7,8 +7,7 @@
582
  * ewmh.c: Get/set certain EWMH properties easily.
583
  *
584
  */
585
-#ifndef I3_EWMH_C
586
-#define I3_EWMH_C
587
+#pragma once
588
 
589
 /**
590
  * Updates _NET_CURRENT_DESKTOP with the current desktop number.
591
@@ -62,5 +61,3 @@ void ewmh_setup_hints(void);
592
  *
593
  */
594
 void ewmh_update_workarea(void);
595
-
596
-#endif

b/include/fake_outputs.h

601
@@ -8,8 +8,7 @@
602
  * which don’t support multi-monitor in a useful way) and for our testsuite.
603
  *
604
  */
605
-#ifndef I3_FAKE_OUTPUTS_H
606
-#define I3_FAKE_OUTPUTS_H
607
+#pragma once
608
 
609
 /**
610
  * Creates outputs according to the given specification.
611
@@ -19,5 +18,3 @@
612
  *
613
  */
614
 void fake_outputs_init(const char *output_spec);
615
-
616
-#endif

b/include/floating.h

621
@@ -7,8 +7,7 @@
622
  * floating.c: Floating windows.
623
  *
624
  */
625
-#ifndef I3_FLOATING_H
626
-#define I3_FLOATING_H
627
+#pragma once
628
 
629
 #include "tree.h"
630
 
631
@@ -183,5 +182,3 @@ void floating_reposition(Con *con, Rect newrect);
632
  *
633
  */
634
 void floating_fix_coordinates(Con *con, Rect *old_rect, Rect *new_rect);
635
-
636
-#endif

b/include/handlers.h

641
@@ -8,8 +8,7 @@
642
  *             …).
643
  *
644
  */
645
-#ifndef I3_HANDLERS_H
646
-#define I3_HANDLERS_H
647
+#pragma once
648
 
649
 #include <xcb/randr.h>
650
 
651
@@ -63,5 +62,3 @@ int handle_window_type(void *data, xcb_connection_t *conn, uint8_t state,
652
                        xcb_window_t window, xcb_atom_t atom,
653
                        xcb_get_property_reply_t *property);
654
 #endif
655
-
656
-#endif

b/include/i3.h

661
@@ -7,8 +7,7 @@
662
  * i3.h: global variables that are used all over i3.
663
  *
664
  */
665
-#ifndef I3_I3_H
666
-#define I3_I3_H
667
+#pragma once
668
 
669
 #include <sys/time.h>
670
 #include <sys/resource.h>
671
@@ -62,5 +61,3 @@ extern bool xcursor_supported, xkb_supported;
672
 extern xcb_window_t root;
673
 extern struct ev_loop *main_loop;
674
 extern bool only_check_config;
675
-
676
-#endif

b/include/i3/ipc.h

681
@@ -8,8 +8,7 @@
682
  * for the IPC interface to i3 (see docs/ipc for more information).
683
  *
684
  */
685
-#ifndef I3_I3_IPC_H
686
-#define I3_I3_IPC_H
687
+#pragma once
688
 
689
 #include <stdint.h>
690
 
691
@@ -101,5 +100,3 @@ typedef struct i3_ipc_header {
692
 
693
 /** Bar config update will be triggered to update the bar config */
694
 #define I3_IPC_EVENT_BARCONFIG_UPDATE           (I3_IPC_EVENT_MASK | 4)
695
-
696
-#endif

b/include/ipc.h

701
@@ -7,8 +7,7 @@
702
  * ipc.c: UNIX domain socket IPC (initialization, client handling, protocol).
703
  *
704
  */
705
-#ifndef I3_IPC_H
706
-#define I3_IPC_H
707
+#pragma once
708
 
709
 #include <ev.h>
710
 #include <stdbool.h>
711
@@ -81,5 +80,3 @@ void ipc_send_event(const char *event, uint32_t message_type, const char *payloa
712
 void ipc_shutdown(void);
713
 
714
 void dump_node(yajl_gen gen, Con *con, bool inplace_restart);
715
-
716
-#endif

b/include/key_press.h

721
@@ -7,8 +7,7 @@
722
  * key_press.c: key press handler
723
  *
724
  */
725
-#ifndef I3_KEY_PRESS_H
726
-#define I3_KEY_PRESS_H
727
+#pragma once
728
 
729
 extern pid_t command_error_nagbar_pid;
730
 
731
@@ -30,5 +29,3 @@ void handle_key_press(xcb_key_press_event_t *event);
732
  *
733
  */
734
 void kill_commanderror_nagbar(bool wait_for_it);
735
-
736
-#endif

b/include/libi3.h

741
@@ -8,8 +8,7 @@
742
  * as i3-msg, i3-config-wizard, …
743
  *
744
  */
745
-#ifndef I3_LIBI3_H
746
-#define I3_LIBI3_H
747
+#pragma once
748
 
749
 #include <stdbool.h>
750
 #include <stdarg.h>
751
@@ -382,5 +381,3 @@ char *get_process_filename(const char *prefix);
752
  * Returned value must be freed by the caller.
753
  */
754
 char *get_exe_path(const char *argv0);
755
-
756
-#endif

b/include/load_layout.h

761
@@ -8,9 +8,6 @@
762
  *                restart.
763
  *
764
  */
765
-#ifndef I3_LOAD_LAYOUT_H
766
-#define I3_LOAD_LAYOUT_H
767
+#pragma once
768
 
769
 void tree_append_json(const char *filename);
770
-
771
-#endif

b/include/log.h

776
@@ -7,8 +7,7 @@
777
  * log.c: Logging functions.
778
  *
779
  */
780
-#ifndef I3_LOG_H
781
-#define I3_LOG_H
782
+#pragma once
783
 
784
 #include <stdarg.h>
785
 #include <stdbool.h>
786
@@ -102,5 +101,3 @@ void verboselog(char *fmt, ...)
787
  * failures. This function is invoked automatically when exiting.
788
  */
789
 void purge_zerobyte_logfile(void);
790
-
791
-#endif

b/include/main.h

796
@@ -7,8 +7,7 @@
797
  * main.c: Initialization, main loop
798
  *
799
  */
800
-#ifndef I3_MAIN_H
801
-#define I3_MAIN_H
802
+#pragma once
803
 
804
 /**
805
  * Enable or disable the main X11 event handling function.
806
@@ -17,5 +16,3 @@
807
  *
808
  */
809
 void main_set_x11_cb(bool enable);
810
-
811
-#endif

b/include/manage.h

816
@@ -7,8 +7,7 @@
817
  * manage.c: Initially managing new windows (or existing ones on restart).
818
  *
819
  */
820
-#ifndef I3_MANAGE_H
821
-#define I3_MANAGE_H
822
+#pragma once
823
 
824
 #include "data.h"
825
 
826
@@ -52,4 +51,3 @@ void reparent_window(xcb_connection_t *conn, xcb_window_t child,
827
                      uint32_t border_width);
828
 
829
 #endif
830
-#endif

b/include/match.h

835
@@ -11,8 +11,7 @@
836
  * match_matches_window() to find the windows affected by this command.
837
  *
838
  */
839
-#ifndef I3_MATCH_H
840
-#define I3_MATCH_H
841
+#pragma once
842
 
843
 /*
844
  * Initializes the Match data structure. This function is necessary because the
845
@@ -46,5 +45,3 @@ bool match_matches_window(Match *match, i3Window *window);
846
  *
847
  */
848
 void match_free(Match *match);
849
-
850
-#endif

b/include/move.h

855
@@ -7,8 +7,7 @@
856
  * move.c: Moving containers into some direction.
857
  *
858
  */
859
-#ifndef I3_MOVE_H
860
-#define I3_MOVE_H
861
+#pragma once
862
 
863
 /**
864
  * Moves the current container in the given direction (TOK_LEFT, TOK_RIGHT,
865
@@ -16,5 +15,3 @@
866
  *
867
  */
868
 void tree_move(int direction);
869
-
870
-#endif

b/include/output.h

875
@@ -7,13 +7,10 @@
876
  * output.c: Output (monitor) related functions.
877
  *
878
  */
879
-#ifndef I3_OUTPUT_H
880
-#define I3_OUTPUT_H
881
+#pragma once
882
 
883
 /**
884
  * Returns the output container below the given output container.
885
  *
886
  */
887
 Con *output_get_content(Con *output);
888
-
889
-#endif

b/include/queue.h

894
@@ -32,8 +32,7 @@
895
  *	@(#)queue.h	8.5 (Berkeley) 8/20/94
896
  */
897
 
898
-#ifndef	_SYS_QUEUE_H_
899
-#define	_SYS_QUEUE_H_
900
+#pragma once
901
 
902
 /*
903
  * This file defines five types of data structures: singly-linked lists,
904
@@ -536,5 +535,3 @@ struct {								\
905
 	_Q_INVALIDATE((elm)->field.cqe_prev);				\
906
 	_Q_INVALIDATE((elm)->field.cqe_next);				\
907
 } while (0)
908
-
909
-#endif	/* !_SYS_QUEUE_H_ */

b/include/randr.h

914
@@ -9,8 +9,7 @@
915
  * (take your time to read it completely, it answers all questions).
916
  *
917
  */
918
-#ifndef I3_RANDR_H
919
-#define I3_RANDR_H
920
+#pragma once
921
 
922
 #include "data.h"
923
 #include <xcb/randr.h>
924
@@ -121,5 +120,3 @@ Output *get_output_next(direction_t direction, Output *current, output_close_far
925
  *
926
  */
927
 Output *get_output_next_wrap(direction_t direction, Output *current);
928
-
929
-#endif

b/include/regex.h

934
@@ -7,8 +7,7 @@
935
  * regex.c: Interface to libPCRE (perl compatible regular expressions).
936
  *
937
  */
938
-#ifndef I3_REGEX_H
939
-#define I3_REGEX_H
940
+#pragma once
941
 
942
 /**
943
  * Creates a new 'regex' struct containing the given pattern and a PCRE
944
@@ -35,5 +34,3 @@ void regex_free(struct regex *regex);
945
  *
946
  */
947
 bool regex_matches(struct regex *regex, const char *input);
948
-
949
-#endif

b/include/render.h

954
@@ -8,8 +8,7 @@
955
  *           various rects. Needs to be pushed to X11 (see x.c) to be visible.
956
  *
957
  */
958
-#ifndef I3_RENDER_H
959
-#define I3_RENDER_H
960
+#pragma once
961
 
962
 /**
963
  * "Renders" the given container (and its children), meaning that all rects are
964
@@ -25,5 +24,3 @@ void render_con(Con *con, bool render_fullscreen);
965
  * Returns the height for the decorations
966
  */
967
 int render_deco_height(void);
968
-
969
-#endif

b/include/resize.h

974
@@ -7,11 +7,8 @@
975
  * resize.c: Interactive resizing.
976
  *
977
  */
978
-#ifndef I3_RESIZE_H
979
-#define I3_RESIZE_H
980
+#pragma once
981
 
982
 bool resize_find_tiling_participants(Con **current, Con **other, direction_t direction);
983
 
984
 int resize_graphical_handler(Con *first, Con *second, orientation_t orientation, const xcb_button_press_event_t *event);
985
-
986
-#endif

b/include/restore_layout.h

991
@@ -8,8 +8,7 @@
992
  *                   parsing (which can be found in load_layout.c).
993
  *
994
  */
995
-#ifndef I3_RESTORE_LAYOUT_H
996
-#define I3_RESTORE_LAYOUT_H
997
+#pragma once
998
 
999
 /**
1000
  * Opens a separate connection to X11 for placeholder windows when restoring
1001
@@ -37,5 +36,3 @@ void restore_open_placeholder_windows(Con *con);
1002
  *
1003
  */
1004
 bool restore_kill_placeholder(xcb_window_t placeholder);
1005
-
1006
-#endif

b/include/scratchpad.h

1011
@@ -7,8 +7,7 @@
1012
  * scratchpad.c: Scratchpad functions (TODO: more description)
1013
  *
1014
  */
1015
-#ifndef I3_SCRATCHPAD_H
1016
-#define I3_SCRATCHPAD_H
1017
+#pragma once
1018
 
1019
 /**
1020
  * Moves the specified window to the __i3_scratch workspace, making it floating
1021
@@ -39,5 +38,3 @@ void scratchpad_show(Con *con);
1022
  *
1023
  */
1024
 void scratchpad_fix_resolution(void);
1025
-
1026
-#endif

b/include/sd-daemon.h

1031
@@ -1,7 +1,6 @@
1032
 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
1033
 
1034
-#ifndef foosddaemonhfoo
1035
-#define foosddaemonhfoo
1036
+#pragma once
1037
 
1038
 /***
1039
   Copyright 2010 Lennart Poettering
1040
@@ -261,5 +260,3 @@ int sd_booted(void) _sd_hidden_;
1041
 #ifdef __cplusplus
1042
 }
1043
 #endif
1044
-
1045
-#endif

b/include/shmlog.h

1050
@@ -8,8 +8,7 @@
1051
  * default (ringbuffer for storing the debug log).
1052
  *
1053
  */
1054
-#ifndef I3_I3_SHMLOG_H
1055
-#define I3_I3_SHMLOG_H
1056
+#pragma once
1057
 
1058
 #include <stdint.h>
1059
 #include <pthread.h>
1060
@@ -43,5 +42,3 @@ typedef struct i3_shmlog_header {
1061
      * tail -f) in an efficient way. */
1062
     pthread_cond_t condvar;
1063
 } i3_shmlog_header;
1064
-
1065
-#endif

b/include/sighandler.h

1070
@@ -9,13 +9,10 @@
1071
  *               to restart inplace).
1072
  *
1073
  */
1074
-#ifndef I3_SIGHANDLER_H
1075
-#define I3_SIGHANDLER_H
1076
+#pragma once
1077
 
1078
 /**
1079
  * Setup signal handlers to safely handle SIGSEGV and SIGFPE
1080
  *
1081
  */
1082
 void setup_signal_handler(void);
1083
-
1084
-#endif

b/include/startup.h

1089
@@ -10,8 +10,7 @@
1090
  *            the appropriate workspace.
1091
  *
1092
  */
1093
-#ifndef I3_STARTUP_H
1094
-#define I3_STARTUP_H
1095
+#pragma once
1096
 
1097
 #define SN_API_NOT_YET_FROZEN 1
1098
 #include <libsn/sn-monitor.h>
1099
@@ -62,5 +61,3 @@ struct Startup_Sequence *startup_sequence_get(i3Window *cwindow,
1100
  *
1101
  */
1102
 char *startup_workspace_for_window(i3Window *cwindow, xcb_get_property_reply_t *startup_id_reply);
1103
-
1104
-#endif

b/include/tree.h

1109
@@ -7,8 +7,7 @@
1110
  * tree.c: Everything that primarily modifies the layout tree data structure.
1111
  *
1112
  */
1113
-#ifndef I3_TREE_H
1114
-#define I3_TREE_H
1115
+#pragma once
1116
 
1117
 extern Con *croot;
1118
 /* TODO: i am not sure yet how much access to the focused container should
1119
@@ -105,5 +104,3 @@ bool tree_restore(const char *path, xcb_get_geometry_reply_t *geometry);
1120
  *
1121
  */
1122
 void tree_flatten(Con *child);
1123
-
1124
-#endif

b/include/util.h

1129
@@ -8,8 +8,7 @@
1130
  *         also libi3).
1131
  *
1132
  */
1133
-#ifndef I3_UTIL_H
1134
-#define I3_UTIL_H
1135
+#pragma once
1136
 
1137
 #include <err.h>
1138
 
1139
@@ -141,5 +140,3 @@ void start_nagbar(pid_t *nagbar_pid, char *argv[]);
1140
  *
1141
  */
1142
 void kill_nagbar(pid_t *nagbar_pid, bool wait_for_it);
1143
-
1144
-#endif

b/include/window.h

1149
@@ -7,8 +7,7 @@
1150
  * window.c: Updates window attributes (X11 hints/properties).
1151
  *
1152
  */
1153
-#ifndef I3_WINDOW_H
1154
-#define I3_WINDOW_H
1155
+#pragma once
1156
 
1157
 /**
1158
  * Updates the WM_CLASS (consisting of the class and instance) for the
1159
@@ -62,5 +61,3 @@ void window_update_role(i3Window *win, xcb_get_property_reply_t *prop, bool befo
1160
  *
1161
  */
1162
 void window_update_hints(i3Window *win, xcb_get_property_reply_t *prop, bool *urgency_hint);
1163
-
1164
-#endif

b/include/workspace.h

1169
@@ -8,8 +8,7 @@
1170
  *              workspaces.
1171
  *
1172
  */
1173
-#ifndef I3_WORKSPACE_H
1174
-#define I3_WORKSPACE_H
1175
+#pragma once
1176
 
1177
 #include "data.h"
1178
 #include "tree.h"
1179
@@ -181,4 +180,3 @@ Con *workspace_attach_to(Con *ws);
1180
  * The container inherits the layout from the workspace.
1181
  */
1182
 Con *workspace_encapsulate(Con *ws);
1183
-#endif

b/include/x.h

1188
@@ -8,8 +8,7 @@
1189
  *      render.c). Basically a big state machine.
1190
  *
1191
  */
1192
-#ifndef I3_X_H
1193
-#define I3_X_H
1194
+#pragma once
1195
 
1196
 /** Stores the X11 window ID of the currently focused window */
1197
 extern xcb_window_t focused_id;
1198
@@ -130,5 +129,3 @@ void x_set_warp_to(Rect *rect);
1199
  *
1200
  */
1201
 void x_mask_event_mask(uint32_t mask);
1202
-
1203
-#endif

b/include/xcb.h

1208
@@ -7,8 +7,7 @@
1209
  * xcb.c: Helper functions for easier usage of XCB
1210
  *
1211
  */
1212
-#ifndef I3_XCB_H
1213
-#define I3_XCB_H
1214
+#pragma once
1215
 
1216
 #include "data.h"
1217
 #include "xcursor.h"
1218
@@ -137,5 +136,3 @@ uint16_t get_visual_depth(xcb_visualid_t visual_id);
1219
  *
1220
  */
1221
 xcb_visualid_t get_visualid_by_depth(uint16_t depth);
1222
-
1223
-#endif

b/include/xcb_compat.h

1228
@@ -9,8 +9,7 @@
1229
  *               older versions.
1230
  *
1231
  */
1232
-#ifndef I3_XCB_COMPAT_H
1233
-#define I3_XCB_COMPAT_H
1234
+#pragma once
1235
 
1236
 #define xcb_icccm_get_wm_protocols_reply_t xcb_get_wm_protocols_reply_t
1237
 #define xcb_icccm_get_wm_protocols xcb_get_wm_protocols
1238
@@ -43,5 +42,3 @@
1239
 #define XCB_ATOM_ATOM ATOM
1240
 #define XCB_ATOM_WM_NORMAL_HINTS WM_NORMAL_HINTS
1241
 #define XCB_ATOM_STRING STRING
1242
-
1243
-#endif

b/include/xcursor.h

1248
@@ -7,8 +7,7 @@
1249
  * xcursor.c: libXcursor support for themed cursors.
1250
  *
1251
  */
1252
-#ifndef I3_XCURSOR_CURSOR_H
1253
-#define I3_XCURSOR_CURSOR_H
1254
+#pragma once
1255
 
1256
 #include <xcb/xcb_cursor.h>
1257
 
1258
@@ -41,5 +40,3 @@ int xcursor_get_xcb_cursor(enum xcursor_cursor_t c);
1259
  *
1260
  */
1261
 void xcursor_set_root_cursor(int cursor_id);
1262
-
1263
-#endif

b/include/xinerama.h

1268
@@ -9,8 +9,7 @@
1269
  * driver which does not support RandR in 2011 *sigh*.
1270
  *
1271
  */
1272
-#ifndef I3_XINERAMA_H
1273
-#define I3_XINERAMA_H
1274
+#pragma once
1275
 
1276
 #include "data.h"
1277
 
1278
@@ -20,5 +19,3 @@
1279
  *
1280
  */
1281
 void xinerama_init(void);
1282
-
1283
-#endif

b/include/yajl_utils.h

1288
@@ -7,8 +7,7 @@
1289
  * yajl_utils.h
1290
  *
1291
  */
1292
-#ifndef I3_YAJL_UTILS_H
1293
-#define I3_YAJL_UTILS_H
1294
+#pragma once
1295
 
1296
 #include <yajl/yajl_gen.h>
1297
 #include <yajl/yajl_parse.h>
1298
@@ -27,5 +26,3 @@ typedef size_t ylength;
1299
 #define yalloc(callbacks, client) yajl_alloc(callbacks, NULL, NULL, client)
1300
 typedef unsigned int ylength;
1301
 #endif
1302
-
1303
-#endif

b/tests/queue.h

1308
@@ -32,8 +32,7 @@
1309
  *	@(#)queue.h	8.5 (Berkeley) 8/20/94
1310
  */
1311
 
1312
-#ifndef	_SYS_QUEUE_H_
1313
-#define	_SYS_QUEUE_H_
1314
+#pragma once
1315
 
1316
 /*
1317
  * This file defines five types of data structures: singly-linked lists,
1318
@@ -523,5 +522,3 @@ struct {								\
1319
 	_Q_INVALIDATE((elm)->field.cqe_prev);				\
1320
 	_Q_INVALIDATE((elm)->field.cqe_next);				\
1321
 } while (0)
1322
-
1323
-#endif	/* !_SYS_QUEUE_H_ */