contrib
debian
docs
i3-config-wizard
i3-dump-log
i3-input
i3-msg
i3-nagbar
i3bar
include
i3
all.h
assignments.h
atoms.xmacro
click.h
cmdparse.h
commands.h
commands_parser.h
con.h
config.h
config_directives.h
config_parser.h
data.h
debug.h
display_version.h
ewmh.h
fake_outputs.h
floating.h
handlers.h
i3.h
ipc.h
key_press.h
libi3.h
load_layout.h
log.h
manage.h
match.h
move.h
output.h
queue.h
randr.h
regex.h
render.h
resize.h
scratchpad.h
sd-daemon.h
shmlog.h
sighandler.h
startup.h
tree.h
util.h
window.h
workspace.h
x.h
xcb.h
xcb_compat.h
xcursor.h
xinerama.h
yajl_utils.h
libi3
man
parser-specs
src
testcases
tests
yajl-fallback
.gitignore
DEPENDS
LICENSE
Makefile
PACKAGE-MAINTAINER
RELEASE-NOTES-4.2
RELEASE-NOTES-4.3
RELEASE-NOTES-4.4
common.mk
generate-command-parser.pl
i3-dmenu-desktop
i3-migrate-config-to-v4
i3-sensible-editor
i3-sensible-pager
i3-sensible-terminal
i3.applications.desktop
i3.config
i3.config.keycodes
i3.xsession.desktop
logo.svg
pseudo-doc.doxygen
Specifically, put the version dependent code in some macros, and put that plus the `y' and `ystr' macros in a separate file, `yajl_utils.h'.
32 lines
831 B
C
32 lines
831 B
C
/*
|
|
* vim:ts=4:sw=4:expandtab
|
|
*
|
|
* i3 - an improved dynamic tiling window manager
|
|
* © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE)
|
|
*
|
|
* yajl_utils.h
|
|
*
|
|
*/
|
|
#ifndef I3_YAJL_UTILS_H
|
|
#define I3_YAJL_UTILS_H
|
|
|
|
#include <yajl/yajl_gen.h>
|
|
#include <yajl/yajl_parse.h>
|
|
#include <yajl/yajl_version.h>
|
|
|
|
/* Shorter names for all those yajl_gen_* functions */
|
|
#define y(x, ...) yajl_gen_ ## x (gen, ##__VA_ARGS__)
|
|
#define ystr(str) yajl_gen_string(gen, (unsigned char*)str, strlen(str))
|
|
|
|
#if YAJL_MAJOR >= 2
|
|
#define ygenalloc() yajl_gen_alloc(NULL)
|
|
#define yalloc(callbacks, client) yajl_alloc(callbacks, NULL, client)
|
|
typedef size_t ylength;
|
|
#else
|
|
#define ygenalloc() yajl_gen_alloc(NULL, NULL);
|
|
#define yalloc(callbacks, client) yajl_alloc(callbacks, NULL, NULL, client)
|
|
typedef unsigned int ylength;
|
|
#endif
|
|
|
|
#endif
|