};
static TAILQ_HEAD(focus_mappings_head, focus_mapping) focus_mappings =
- TAILQ_HEAD_INITIALIZER(focus_mappings);
+ TAILQ_HEAD_INITIALIZER(focus_mappings);
static int json_start_map(void *ctx) {
LOG("start of map, last_key = %s\n", last_key);
if (parsing_focus) {
/* Clear the list of focus mappings */
struct focus_mapping *mapping;
- TAILQ_FOREACH_REVERSE(mapping, &focus_mappings, focus_mappings_head, focus_mappings) {
+ TAILQ_FOREACH_REVERSE (mapping, &focus_mappings, focus_mappings_head, focus_mappings) {
LOG("focus (reverse) %d\n", mapping->old_id);
Con *con;
- TAILQ_FOREACH(con, &(json_node->focus_head), focused) {
+ TAILQ_FOREACH (con, &(json_node->focus_head), focused) {
if (con->old_id != mapping->old_id)
continue;
LOG("got it! %p\n", con);
static int json_key(void *ctx, const unsigned char *val, size_t len) {
LOG("key: %.*s\n", (int)len, val);
FREE(last_key);
- last_key = scalloc((len+1) * sizeof(char));
+ last_key = scalloc((len + 1) * sizeof(char));
memcpy(last_key, val, len);
if (strcasecmp(last_key, "swallows") == 0)
parsing_swallows = true;
free(sval);
} else {
if (strcasecmp(last_key, "name") == 0) {
- json_node->name = scalloc((len+1) * sizeof(char));
+ json_node->name = scalloc((len + 1) * sizeof(char));
memcpy(json_node->name, val, len);
} else if (strcasecmp(last_key, "sticky_group") == 0) {
- json_node->sticky_group = scalloc((len+1) * sizeof(char));
+ json_node->sticky_group = scalloc((len + 1) * sizeof(char));
memcpy(json_node->sticky_group, val, len);
LOG("sticky_group of this container is %s\n", json_node->sticky_group);
} else if (strcasecmp(last_key, "orientation") == 0) {
json_node->last_split_layout = L_SPLITH;
else if (strcasecmp(buf, "vertical") == 0)
json_node->last_split_layout = L_SPLITV;
- else LOG("Unhandled orientation: %s\n", buf);
+ else
+ LOG("Unhandled orientation: %s\n", buf);
free(buf);
} else if (strcasecmp(last_key, "border") == 0) {
char *buf = NULL;
json_node->border_style = BS_PIXEL;
else if (strcasecmp(buf, "normal") == 0)
json_node->border_style = BS_NORMAL;
- else LOG("Unhandled \"border\": %s\n", buf);
+ else
+ LOG("Unhandled \"border\": %s\n", buf);
free(buf);
} else if (strcasecmp(last_key, "type") == 0) {
char *buf = NULL;
json_node->type = CT_WORKSPACE;
else if (strcasecmp(buf, "dockarea") == 0)
json_node->type = CT_DOCKAREA;
- else LOG("Unhandled \"type\": %s\n", buf);
+ else
+ LOG("Unhandled \"type\": %s\n", buf);
free(buf);
} else if (strcasecmp(last_key, "layout") == 0) {
char *buf = NULL;
json_node->layout = L_SPLITH;
else if (strcasecmp(buf, "splitv") == 0)
json_node->layout = L_SPLITV;
- else LOG("Unhandled \"layout\": %s\n", buf);
+ else
+ LOG("Unhandled \"layout\": %s\n", buf);
free(buf);
} else if (strcasecmp(last_key, "workspace_layout") == 0) {
char *buf = NULL;
json_node->workspace_layout = L_STACKED;
else if (strcasecmp(buf, "tabbed") == 0)
json_node->workspace_layout = L_TABBED;
- else LOG("Unhandled \"workspace_layout\": %s\n", buf);
+ else
+ LOG("Unhandled \"workspace_layout\": %s\n", buf);
free(buf);
} else if (strcasecmp(last_key, "last_split_layout") == 0) {
char *buf = NULL;
json_node->last_split_layout = L_SPLITH;
else if (strcasecmp(buf, "splitv") == 0)
json_node->last_split_layout = L_SPLITV;
- else LOG("Unhandled \"last_splitlayout\": %s\n", buf);
+ else
+ LOG("Unhandled \"last_splitlayout\": %s\n", buf);
free(buf);
} else if (strcasecmp(last_key, "mark") == 0) {
char *buf = NULL;
r = &(json_node->rect);
else if (parsing_window_rect)
r = &(json_node->window_rect);
- else r = &(json_node->geometry);
+ else
+ r = &(json_node->geometry);
if (strcasecmp(last_key, "x") == 0)
r->x = val;
else if (strcasecmp(last_key, "y") == 0)
r->width = val;
else if (strcasecmp(last_key, "height") == 0)
r->height = val;
- else ELOG("WARNING: unknown key %s in rect\n", last_key);
+ else
+ ELOG("WARNING: unknown key %s in rect\n", last_key);
DLOG("rect now: (%d, %d, %d, %d)\n",
- r->x, r->y, r->width, r->height);
+ r->x, r->y, r->width, r->height);
}
if (parsing_swallows) {
if (strcasecmp(last_key, "id") == 0) {
.yajl_end_array = json_end_array,
};
g = yajl_gen_alloc(NULL);
- hand = yajl_alloc(&callbacks, NULL, (void*)g);
+ hand = yajl_alloc(&callbacks, NULL, (void *)g);
/* Allowing comments allows for more user-friendly layout files. */
yajl_config(hand, yajl_allow_comments, true);
/* Allow multiple values, i.e. multiple nodes to attach */
parsing_geometry = false;
parsing_focus = false;
setlocale(LC_NUMERIC, "C");
- stat = yajl_parse(hand, (const unsigned char*)buf, n);
- if (stat != yajl_status_ok)
- {
- unsigned char *str = yajl_get_error(hand, 1, (const unsigned char*)buf, n);
+ stat = yajl_parse(hand, (const unsigned char *)buf, n);
+ if (stat != yajl_status_ok) {
+ unsigned char *str = yajl_get_error(hand, 1, (const unsigned char *)buf, n);
ELOG("JSON parsing error: %s\n", str);
if (errormsg != NULL)
- *errormsg = sstrdup((const char*)str);
+ *errormsg = sstrdup((const char *)str);
yajl_free_error(hand, str);
}