]> git.sur5r.net Git - i3/i3/blobdiff - src/config_parser.c
Extract workspace names from bindings before reordering.
[i3/i3] / src / config_parser.c
index 4e16f0605f9b4cccdb943fa1376f8669bcc069e3..ea00412d78b2d2533c5dd0b87486aaa3da7e9f4e 100644 (file)
@@ -202,9 +202,9 @@ static TAILQ_HEAD(criteria_head, criterion) criteria =
  */
 static void push_criterion(void *unused_criteria, const char *type,
                            const char *value) {
-    struct criterion *criterion = malloc(sizeof(struct criterion));
-    criterion->type = strdup(type);
-    criterion->value = strdup(value);
+    struct criterion *criterion = smalloc(sizeof(struct criterion));
+    criterion->type = sstrdup(type);
+    criterion->value = sstrdup(value);
     TAILQ_INSERT_TAIL(&criteria, criterion, criteria);
 }
 
@@ -931,7 +931,7 @@ bool parse_file(const char *f, bool use_nagbar) {
     /* Then, allocate a new buffer and copy the file over to the new one,
      * but replace occurences of our variables */
     char *walk = buf, *destwalk;
-    char *new = smalloc((stbuf.st_size + extra_bytes + 1) * sizeof(char));
+    char *new = smalloc(stbuf.st_size + extra_bytes + 1);
     destwalk = new;
     while (walk < (buf + stbuf.st_size)) {
         /* Find the next variable */
@@ -996,7 +996,9 @@ bool parse_file(const char *f, bool use_nagbar) {
     struct ConfigResultIR *config_output = parse_config(new, context);
     yajl_gen_free(config_output->json_gen);
 
+    extract_workspace_names_from_bindings();
     check_for_duplicate_bindings(context);
+    reorder_bindings();
 
     if (use_nagbar && (context->has_errors || context->has_warnings)) {
         ELOG("FYI: You are using i3 version %s\n", i3_version);