Reuse success flag.
authorDaniel Carl <danielcarl@gmx.de>
Sat, 2 Jun 2018 20:11:09 +0000 (22:11 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Sat, 2 Jun 2018 20:11:09 +0000 (22:11 +0200)
src/input.c

index 66abfbc..02ad3f2 100644 (file)
@@ -116,7 +116,7 @@ VbResult input_open_editor(Client *c)
     const char *text = NULL, *id = NULL, *editor_command;
     int argc;
     GPid pid;
-    gboolean success, idSuccess;
+    gboolean success;
     GVariant *jsreturn;
     GVariant *idreturn;
     GError *error = NULL;
@@ -139,16 +139,16 @@ VbResult input_open_editor(Client *c)
     }
 
     idreturn = ext_proxy_eval_script_sync(c, "vimb_input_mode_element.id");
-    g_variant_get(idreturn, "(bs)", &idSuccess, &id);
+    g_variant_get(idreturn, "(bs)", &success, &id);
 
     /* Special case: the input element does not have an id assigned to it */
-    if (!idSuccess || !id || strlen(id) == 0) {
+    if (!success || !*id) {
         element_map_key = element_map_next_key++;
         char *js_command = g_strdup_printf(JS_SET_EDITOR_MAP_ELEMENT, element_map_key);
         ext_proxy_eval_script(c, js_command, NULL);
         g_free(js_command);
     } else {
-        element_id   = g_strdup(id);
+        element_id = g_strdup(id);
     }
 
     /* create a temp file to pass text to and from editor */
@@ -184,9 +184,9 @@ VbResult input_open_editor(Client *c)
 
     /* watch the editor process */
     EditorData *data = g_slice_new0(EditorData);
-    data->file = file_path;
-    data->c    = c;
-    data->element_id = element_id;
+    data->file            = file_path;
+    data->c               = c;
+    data->element_id      = element_id;
     data->element_map_key = element_map_key;
 
     g_child_watch_add(pid, (GChildWatchFunc)resume_editor, data);