Просмотр исходного кода

Prepare data for server status (Step 3/?) (See #243)

bel2125 8 лет назад
Родитель
Сommit
14e28127e9
2 измененных файлов с 17 добавлено и 7 удалено
  1. 11 0
      Makefile
  2. 6 7
      src/civetweb.c

+ 11 - 0
Makefile

@@ -110,6 +110,16 @@ endif
 ifdef WITH_WEBSOCKET
   CFLAGS += -DUSE_WEBSOCKET
 endif
+ifdef WITH_WEBSOCKETS
+  CFLAGS += -DUSE_WEBSOCKET
+endif
+
+ifdef WITH_SERVER_STAT
+  CFLAGS += -DUSE_SERVER_STATS
+endif
+ifdef WITH_SERVER_STATS
+  CFLAGS += -DUSE_SERVER_STATS
+endif
 
 ifdef CONFIG_FILE
   CFLAGS += -DCONFIG_FILE=\"$(CONFIG_FILE)\"
@@ -180,6 +190,7 @@ help:
 	@echo "   WITH_DEBUG=1          build with GDB debug support"
 	@echo "   WITH_IPV6=1           with IPV6 support"
 	@echo "   WITH_WEBSOCKET=1      build with web socket support"
+	@echo "   WITH_SERVER_STATS=1   build includes support for server statistics"
 	@echo "   WITH_CPP=1            build library with c++ classes"
 	@echo "   CONFIG_FILE=file      use 'file' as the config file"
 	@echo "   CONFIG_FILE2=file     use 'file' as the backup config file"

+ 6 - 7
src/civetweb.c

@@ -955,9 +955,7 @@ mg_calloc_ex(size_t count,
              const char *file,
              unsigned line)
 {
-	void *data = mg_malloc_ex(size * count, file, line);
-
-	(void)ctx;
+	void *data = mg_malloc_ex(size * count, ctx, file, line);
 
 	if (data) {
 		memset(data, 0, size * count);
@@ -1018,8 +1016,6 @@ mg_realloc_ex(void *memory,
 	void *_realloc;
 	size_t oldsize;
 
-	(void)ctx;
-
 	if (newsize) {
 		if (memory) {
 			data = (void *)(((char *)memory) - sizeof(size_t));
@@ -1072,11 +1068,11 @@ mg_realloc_ex(void *memory,
 				return _realloc;
 			}
 		} else {
-			data = mg_malloc_ex(newsize, file, line);
+			data = mg_malloc_ex(newsize, ctx, file, line);
 		}
 	} else {
 		data = 0;
-		mg_free_ex(memory, file, line);
+		mg_free_ex(memory, ctx, file, line);
 	}
 
 	return data;
@@ -15494,6 +15490,9 @@ mg_check_feature(unsigned feature)
 #if !defined(NO_CACHING)
 	                                    | 0x0080u
 #endif
+#if defined(USE_SERVER_STATS)
+	                                    | 0x0100u
+#endif
 
 /* Set some extra bits not defined in the API documentation.
  * These bits may change without further notice. */