Przeglądaj źródła

Make global constant arrays itself const

xtne6f 6 lat temu
rodzic
commit
536c12b0af
3 zmienionych plików z 18 dodań i 18 usunięć
  1. 12 12
      src/civetweb.c
  2. 4 4
      src/mod_duktape.inl
  3. 2 2
      src/mod_lua.inl

+ 12 - 12
src/civetweb.c

@@ -2201,18 +2201,18 @@ static struct ssl_func crypto_sw[] = {{"CRYPTO_num_locks", NULL},
 
 
 #if !defined(NO_CACHING)
-static const char *month_names[] = {"Jan",
-                                    "Feb",
-                                    "Mar",
-                                    "Apr",
-                                    "May",
-                                    "Jun",
-                                    "Jul",
-                                    "Aug",
-                                    "Sep",
-                                    "Oct",
-                                    "Nov",
-                                    "Dec"};
+static const char month_names[][4] = {"Jan",
+                                      "Feb",
+                                      "Mar",
+                                      "Apr",
+                                      "May",
+                                      "Jun",
+                                      "Jul",
+                                      "Aug",
+                                      "Sep",
+                                      "Oct",
+                                      "Nov",
+                                      "Dec"};
 #endif /* !NO_CACHING */
 
 /* Unified socket address. For IPv6 support, add IPv6 address structure in

+ 4 - 4
src/mod_duktape.inl

@@ -13,10 +13,10 @@
 
 /* Note: This is only experimental support, so the API may still change. */
 
-static const char *civetweb_conn_id = "\xFF"
-                                      "civetweb_conn";
-static const char *civetweb_ctx_id = "\xFF"
-                                     "civetweb_ctx";
+static const char *const civetweb_conn_id = "\xFF"
+                                            "civetweb_conn";
+static const char *const civetweb_ctx_id = "\xFF"
+                                           "civetweb_ctx";
 
 
 static void *

+ 2 - 2
src/mod_lua.inl

@@ -48,11 +48,11 @@ munmap(void *addr, int64_t length)
 #include <sys/mman.h>
 #endif
 
-static const char *LUASOCKET = "luasocket";
+static const char *const LUASOCKET = "luasocket";
 static const char lua_regkey_ctx = 1;
 static const char lua_regkey_connlist = 2;
 static const char lua_regkey_lsp_include_history = 3;
-static const char *LUABACKGROUNDPARAMS = "mg";
+static const char *const LUABACKGROUNDPARAMS = "mg";
 
 /* Limit nesting depth of mg.include.
  * This takes a lot of stack (~10 kB per recursion),