[gnome-builder] clang: cleanup handlers
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] clang: cleanup handlers
- Date: Sun, 22 Apr 2018 01:42:58 +0000 (UTC)
commit 8118a59c77dbd859bbe5399128d23d64e6c0abf3
Author: Christian Hergert <chergert redhat com>
Date: Sat Apr 21 18:26:00 2018 -0700
clang: cleanup handlers
src/plugins/clang/gnome-builder-clang.c | 36 +++++++++------------------------
src/plugins/clang/test-daemon.c | 2 +-
2 files changed, 11 insertions(+), 27 deletions(-)
---
diff --git a/src/plugins/clang/gnome-builder-clang.c b/src/plugins/clang/gnome-builder-clang.c
index 56de28708..c8aae507c 100644
--- a/src/plugins/clang/gnome-builder-clang.c
+++ b/src/plugins/clang/gnome-builder-clang.c
@@ -288,7 +288,7 @@ handle_find_nearest_scope (JsonrpcServer *server,
g_assert (JSONRPC_IS_SERVER (server));
g_assert (JSONRPC_IS_CLIENT (client));
- g_assert (g_str_equal (method, "clang/find-nearest-scope"));
+ g_assert (g_str_equal (method, "clang/findNearestScope"));
g_assert (id != NULL);
g_assert (IDE_IS_CLANG (clang));
@@ -551,32 +551,16 @@ main (gint argc,
G_CALLBACK (on_client_closed_cb),
NULL);
- jsonrpc_server_add_handler (server,
- "initialize",
- (JsonrpcServerHandler)handle_initialize,
- g_object_ref (clang),
- g_object_unref);
- jsonrpc_server_add_handler (server,
- "clang/indexFile",
- (JsonrpcServerHandler)handle_index_file,
- g_object_ref (clang),
- g_object_unref);
- jsonrpc_server_add_handler (server,
- "clang/find-nearest-scope",
- (JsonrpcServerHandler)handle_find_nearest_scope,
- g_object_ref (clang),
- g_object_unref);
- jsonrpc_server_add_handler (server,
- "clang/diagnose",
- (JsonrpcServerHandler)handle_diagnose,
- g_object_ref (clang),
- g_object_unref);
- jsonrpc_server_add_handler (server,
- "clang/complete",
- (JsonrpcServerHandler)handle_complete,
- g_object_ref (clang),
- g_object_unref);
+#define ADD_HANDLER(method, func) \
+ jsonrpc_server_add_handler (server, method, (JsonrpcServerHandler)func, g_object_ref (clang),
g_object_unref)
+ ADD_HANDLER ("initialize", handle_initialize);
+ ADD_HANDLER ("clang/indexFile", handle_index_file);
+ ADD_HANDLER ("clang/findNearestScope", handle_find_nearest_scope);
+ ADD_HANDLER ("clang/diagnose", handle_diagnose);
+ ADD_HANDLER ("clang/complete", handle_complete);
+
+#undef ADD_HANDLER
jsonrpc_server_accept_io_stream (server, stream);
diff --git a/src/plugins/clang/test-daemon.c b/src/plugins/clang/test-daemon.c
index 9c1adb291..255357281 100644
--- a/src/plugins/clang/test-daemon.c
+++ b/src/plugins/clang/test-daemon.c
@@ -142,7 +142,7 @@ test_find_scope (JsonrpcClient *client,
);
jsonrpc_client_call_async (client,
- "clang/find-nearest-scope",
+ "clang/findNearestScope",
params,
NULL,
test_find_scope_cb,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]