]> git.sur5r.net Git - i3/i3/blobdiff - src/config_parser.c
Merge branch 'master' into next
[i3/i3] / src / config_parser.c
index a3730233aec5d1a4fd4ed8dc136291d5523eca0b..cb21dae7c9c058ad601eaf445470c1f67223a0ec 100644 (file)
@@ -159,7 +159,7 @@ static const char *get_string(const char *identifier) {
     return NULL;
 }
 
-static const long get_long(const char *identifier) {
+static long get_long(const char *identifier) {
     for (int c = 0; c < 10; c++) {
         if (stack[c].identifier == NULL)
             break;
@@ -346,7 +346,7 @@ struct ConfigResult *parse_config(const char *input, struct context *context) {
 
     /* The "<=" operator is intentional: We also handle the terminating 0-byte
      * explicitly by looking for an 'end' token. */
-    while ((walk - input) <= len) {
+    while ((size_t)(walk - input) <= len) {
         /* Skip whitespace before every token, newlines are relevant since they
          * separate configuration directives. */
         while ((*walk == ' ' || *walk == '\t') && *walk != '\0')
@@ -446,6 +446,16 @@ struct ConfigResult *parse_config(const char *input, struct context *context) {
                 }
             }
 
+            if (strcmp(token->name, "line") == 0) {
+               while (*walk != '\0' && *walk != '\n' && *walk != '\r')
+                  walk++;
+               next_state(token);
+               token_handled = true;
+               linecnt++;
+               walk++;
+               break;
+            }
+
             if (strcmp(token->name, "end") == 0) {
                 //printf("checking for end: *%s*\n", walk);
                 if (*walk == '\0' || *walk == '\n' || *walk == '\r') {
@@ -575,7 +585,7 @@ struct ConfigResult *parse_config(const char *input, struct context *context) {
             y(map_close);
 
             /* Skip the rest of this line, but continue parsing. */
-            while ((walk - input) <= len && *walk != '\n')
+            while ((size_t)(walk - input) <= len && *walk != '\n')
                 walk++;
 
             free(position);