]> git.sur5r.net Git - i3/i3/commitdiff
restore i3bar compatibility with libyajl version 1
authorhaptix@web.de <haptix@web.de>
Sat, 6 Apr 2013 12:50:46 +0000 (14:50 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Sun, 7 Apr 2013 13:54:20 +0000 (15:54 +0200)
fixes #1004

i3bar/src/child.c

index ad93681c65f3d352b085347f802d9dd1aeeb5327..4e5e49c928edf37f1e3ff450c0cb5b5c0f87ddaa 100644 (file)
@@ -359,7 +359,11 @@ void child_sig_cb(struct ev_loop *loop, ev_child *watcher, int revents) {
 void child_write_output(void) {
     if (child.click_events) {
         const unsigned char *output;
+#if YAJL_MAJOR < 2
+        unsigned int size;
+#else
         size_t size;
+#endif
         yajl_gen_get_buf(gen, &output, &size);
         write(child_stdin, output, size);
         write(child_stdin, "\n", 1);
@@ -388,11 +392,13 @@ void start_child(char *command) {
     yajl_parser_config parse_conf = { 0, 0 };
 
     parser = yajl_alloc(&callbacks, &parse_conf, NULL, (void*)&parser_context);
+
+    gen = yajl_gen_alloc(NULL, NULL);
 #else
     parser = yajl_alloc(&callbacks, NULL, &parser_context);
-#endif
 
     gen = yajl_gen_alloc(NULL);
+#endif
 
     if (command != NULL) {
         int pipe_in[2]; /* pipe we read from */