]> git.sur5r.net Git - i3/i3/blobdiff - src/commands_parser.c
Replace strncpy call with memcpy when result is not NUL-terminated
[i3/i3] / src / commands_parser.c
index d311fdd17c683d605e7a30f08d3dcc9f201fc6a0..98f0665907dd36d759abebd4a55b09024a2f55c6 100644 (file)
@@ -1,5 +1,3 @@
-#undef I3__FILE__
-#define I3__FILE__ "commands_parser.c"
 /*
  * vim:ts=4:sw=4:expandtab
  *
@@ -25,6 +23,8 @@
  * instead of actually calling any function).
  *
  */
+#include "all.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -32,8 +32,6 @@
 #include <stdbool.h>
 #include <stdint.h>
 
-#include "all.h"
-
 // Macros to make the YAJL API a bit easier to use.
 #define y(x, ...) (command_output.json_gen != NULL ? yajl_gen_##x(command_output.json_gen, ##__VA_ARGS__) : 0)
 #define ystr(str) (command_output.json_gen != NULL ? yajl_gen_string(command_output.json_gen, (unsigned char *)str, strlen(str)) : 0)
@@ -133,10 +131,8 @@ static void push_long(const char *identifier, long num) {
     exit(1);
 }
 
-// XXX: ideally, this would be const char. need to check if that works with all
-// called functions.
 // TODO move to a common util
-static char *get_string(const char *identifier) {
+static const char *get_string(const char *identifier) {
     for (int c = 0; c < 10; c++) {
         if (stack[c].identifier == NULL)
             break;