Skip to content

Commit d0bd0ed

Browse files
committed
Revert "Merge remote-tracking branch 'besser82/bugfix/json-c' into 0.15"
This reverts commit 1c4a086, reversing changes made to 1263ea6.
1 parent 1c4a086 commit d0bd0ed

File tree

9 files changed

+17
-48
lines changed

9 files changed

+17
-48
lines changed

.travis.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ compiler:
66
- gcc
77
- clang
88

9-
env:
10-
- BUILD_TYPE=Release
11-
- BUILD_TYPE=Debug
12-
- BUILD_TYPE=ASAN
13-
149
arch:
1510
packages:
1611
- cmake
@@ -24,7 +19,7 @@ arch:
2419
- wlc-git
2520
- libcap
2621
script:
27-
- "cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE ."
22+
- "cmake ."
2823
- "make"
2924

3025
script:

CMakeLists.txt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,6 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
99
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
1010
add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-unused-result -Werror)
1111

12-
# Add Address Sanitiezed build type
13-
set(CMAKE_C_FLAGS_ASAN
14-
"${CMAKE_C_FLAGS_DEBUG} -fsanitize=address -fno-omit-frame-pointer"
15-
CACHE STRING "Flags used by the C compiler during address sanitizer builds."
16-
FORCE )
17-
mark_as_advanced(
18-
CMAKE_C_FLAGS_ASAN
19-
CMAKE_EXE_LINKER_FLAGS_DEBUG
20-
CMAKE_SHARED_LINKER_FLAGS_DEBUG
21-
)
22-
2312
list(INSERT CMAKE_MODULE_PATH 0
2413
${CMAKE_CURRENT_SOURCE_DIR}/CMake
2514
)

include/sway_json_helper.h

Lines changed: 0 additions & 16 deletions
This file was deleted.

include/swaygrab/json.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "sway_json_helper.h"
1+
#include <json-c/json.h>
22
#include "wlc/wlc.h"
33

44
void init_json_tree(int socketfd);

sway/ipc-server.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <stdlib.h>
1616
#include <sys/ioctl.h>
1717
#include <fcntl.h>
18+
#include <json-c/json.h>
1819
#include <list.h>
1920
#include <libinput.h>
2021
#ifdef __linux__
@@ -24,7 +25,6 @@ struct ucred {
2425
gid_t gid;
2526
};
2627
#endif
27-
#include "sway_json_helper.h"
2828
#include "sway/ipc-json.h"
2929
#include "sway/ipc-server.h"
3030
#include "sway/security.h"
@@ -724,7 +724,7 @@ void ipc_client_handle_command(struct ipc_client *client) {
724724
}
725725

726726
// parse requested event types
727-
for (json_ar_len_t i = 0; i < json_object_array_length(request); i++) {
727+
for (int i = 0; i < json_object_array_length(request); i++) {
728728
const char *event_type = json_object_get_string(json_object_array_get_idx(request, i));
729729
if (strcmp(event_type, "workspace") == 0) {
730730
client->subscribed_events |= event_mask(IPC_EVENT_WORKSPACE);
@@ -1126,8 +1126,7 @@ static void ipc_event_binding(json_object *sb_obj) {
11261126
sway_log(L_DEBUG, "Sending binding::run event");
11271127
json_object *obj = json_object_new_object();
11281128
json_object_object_add(obj, "change", json_object_new_string("run"));
1129-
// sb_obj gets owned by the temporary json_object, too.
1130-
json_object_object_add(obj, "binding", json_object_get(sb_obj));
1129+
json_object_object_add(obj, "binding", sb_obj);
11311130

11321131
const char *json_string = json_object_to_json_string(obj);
11331132
ipc_send_event(json_string, IPC_EVENT_BINDING);

swaybar/status_line.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#include <stdlib.h>
33
#include <string.h>
44
#include <unistd.h>
5+
#include <json-c/json.h>
56

6-
#include "sway_json_helper.h"
77
#include "swaybar/config.h"
88
#include "swaybar/status_line.h"
99
#include "log.h"
@@ -70,7 +70,8 @@ static void parse_json(struct bar *bar, const char *text) {
7070

7171
bar->status->block_line = create_list();
7272

73-
for (json_ar_len_t i = 0; i < json_object_array_length(results); ++i) {
73+
int i;
74+
for (i = 0; i < json_object_array_length(results); ++i) {
7475
json_object *full_text, *short_text, *color, *min_width, *align, *urgent;
7576
json_object *name, *instance, *separator, *separator_block_width;
7677
json_object *background, *border, *border_top, *border_bottom;

swaygrab/json.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ static json_object *get_focused_container_r(json_object *c) {
5050
} else {
5151
json_object *nodes, *node, *child;
5252
json_object_object_get_ex(c, "nodes", &nodes);
53-
for (json_ar_len_t i = 0; i < json_object_array_length(nodes); i++) {
53+
int i;
54+
for (i = 0; i < json_object_array_length(nodes); i++) {
5455
node = json_object_array_get_idx(nodes, i);
5556

5657
if ((child = get_focused_container_r(node))) {
@@ -59,7 +60,7 @@ static json_object *get_focused_container_r(json_object *c) {
5960
}
6061

6162
json_object_object_get_ex(c, "floating_nodes", &nodes);
62-
for (json_ar_len_t i = 0; i < json_object_array_length(nodes); i++) {
63+
for (i = 0; i < json_object_array_length(nodes); i++) {
6364
node = json_object_array_get_idx(nodes, i);
6465

6566
if ((child = get_focused_container_r(node))) {
@@ -82,7 +83,7 @@ char *get_focused_output() {
8283
if (!outputs) {
8384
sway_abort("Unabled to get focused output. No nodes in tree.");
8485
}
85-
for (json_ar_len_t i = 0; i < json_object_array_length(outputs); i++) {
86+
for (int i = 0; i < json_object_array_length(outputs); i++) {
8687
output = json_object_array_get_idx(outputs, i);
8788

8889
if (get_focused_container_r(output)) {
@@ -130,7 +131,7 @@ json_object *get_output_container(const char *output) {
130131
json_object *outputs, *json_output, *name;
131132
json_object_object_get_ex(tree, "nodes", &outputs);
132133

133-
for (json_ar_len_t i = 0; i < json_object_array_length(outputs); i++) {
134+
for (int i = 0; i < json_object_array_length(outputs); i++) {
134135
json_output = json_object_array_get_idx(outputs, i);
135136
json_object_object_get_ex(json_output, "name", &name);
136137

swaylock/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <xkbcommon/xkbcommon.h>
44
#include <xkbcommon/xkbcommon-names.h>
55
#include <security/pam_appl.h>
6+
#include <json-c/json.h>
67
#include <stdio.h>
78
#include <stdlib.h>
89
#include <string.h>
@@ -13,7 +14,6 @@
1314
#include <signal.h>
1415
#include <stdbool.h>
1516
#include <unistd.h>
16-
#include "sway_json_helper.h"
1717
#include "client/window.h"
1818
#include "client/registry.h"
1919
#include "client/cairo.h"
@@ -583,7 +583,7 @@ int main(int argc, char **argv) {
583583

584584
for (i = 0; i < registry->outputs->length; ++i) {
585585
if (displays_paths[i * 2] != NULL) {
586-
for (json_ar_len_t j = 0;; ++j) {
586+
for (int j = 0;; ++j) {
587587
if (j >= json_object_array_length(json_outputs)) {
588588
sway_log(L_ERROR, "%s is not an extant output", displays_paths[i * 2]);
589589
exit(EXIT_FAILURE);

swaymsg/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <sys/socket.h>
1010
#include <ctype.h>
1111
#include <unistd.h>
12-
#include "sway_json_helper.h"
12+
#include <json-c/json.h>
1313
#include "stringop.h"
1414
#include "ipc-client.h"
1515
#include "readline.h"
@@ -149,7 +149,7 @@ static void pretty_print_version(json_object *v) {
149149
static void pretty_print_clipboard(json_object *v) {
150150
if (success(v, true)) {
151151
if (json_object_is_type(v, json_type_array)) {
152-
for (json_ar_len_t i = 0; i < json_object_array_length(v); ++i) {
152+
for (int i = 0; i < json_object_array_length(v); ++i) {
153153
json_object *o = json_object_array_get_idx(v, i);
154154
printf("%s\n", json_object_get_string(o));
155155
}

0 commit comments

Comments
 (0)