default:
/* if is printable ascii char, than write it at the cursor
- * position into input box */
+ * position into input box */
if (key >= 0x20 && key <= 0x7e) {
gtk_text_buffer_insert_at_cursor(buffer, (char[2]){key, 0}, 1);
} else {
{
if (arg->code == EX_TABOPEN) {
return vb_load_uri(&((Arg){VB_TARGET_NEW, arg->rhs->str}));
- } else {
- return vb_load_uri(&((Arg){VB_TARGET_CURRENT, arg->rhs->str}));
}
+ return vb_load_uri(&((Arg){VB_TARGET_CURRENT, arg->rhs->str}));
}
#ifdef FEATURE_QUEUE
static gboolean ex_set(const ExArg *arg)
{
- gboolean success;
char *param = NULL;
if (!arg->rhs->len) {
/* split the input string into parameter and value part */
if ((param = strchr(arg->rhs->str, '='))) {
*param++ = '\0';
- success = setting_run(arg->rhs->str, param ? param : NULL);
- } else {
- success = setting_run(arg->rhs->str, NULL);
+ return setting_run(arg->rhs->str, param ? param : NULL);
}
- return success;
+ return setting_run(arg->rhs->str, NULL);
}
static gboolean ex_shellcmd(const ExArg *arg)
gboolean handle_uri(const char *uri)
{
- char *handler;
+ char *handler, *cmd;
GError *error = NULL;
- char *cmd;
gboolean result;
if (!(handler = handler_lookup(uri))) {
{
char *value = js_object_call_function(hints.ctx, hints.obj, func, count, params);
- if (!value) {
- return false;
- }
+ g_return_val_if_fail(value != NULL, false);
if (!strncmp(value, "ERROR:", 6)) {
g_free(value);
#include "history.h"
#include "util.h"
#include "completion.h"
+#include "ascii.h"
extern VbCore vb;
char **parts;
int len;
- while (g_ascii_isspace(*line)) {
+ while (VB_IS_SPACE(*line)) {
line++;
}
if (!*line) {
GPid pid;
gboolean success;
- if (!vb.config.editor_command) {
+ if (!vb.config.editor_command || !*vb.config.editor_command) {
vb_echo(VB_MSG_ERROR, true, "No editor-command configured");
return RESULT_ERROR;
}
JSStringRef js_func = NULL;
char *value;
- if (!obj) {
- return NULL;
- }
+ g_return_val_if_fail(obj != NULL, NULL);
js_func = JSStringCreateWithUTF8CString(func);
if (!JSObjectHasProperty(ctx, obj, js_func)) {
}
/**
- * Retrune a new allocates string for given valeu reference.
+ * Retrune a new allocates string for given value reference.
* String must be freed if not used anymore.
*/
char* js_ref_to_string(JSContextRef ctx, JSValueRef ref)
size_t len;
JSStringRef str_ref;
- if (!ref) {
- return NULL;
- }
+ g_return_val_if_fail(ref != NULL, NULL);
str_ref = JSValueToStringCopy(ctx, ref, NULL);
len = JSStringGetMaximumUTF8CStringSize(str_ref);
}
}
- /* should never be reached */
- return MAP_DONE;
+ g_return_val_if_reached(MAP_DONE);
}
/**
#include "mode.h"
#include "normal.h"
#include "ascii.h"
+#include <glib.h>
static GHashTable *modes = NULL;
extern VbCore vb;
void mode_enter(char id)
{
Mode *new = g_hash_table_lookup(modes, GINT_TO_POINTER(id));
- if (!new) {
- PRINT_DEBUG("!mode %c not found", id);
- return;
- }
+
+ g_return_if_fail(new != NULL);
if (vb.mode) {
/* don't do anything if the mode isn't a new one */