improve static allocation notice 58/3058/1
authorAndy Green <andy.green@linaro.org>
Mon, 11 Feb 2013 03:04:56 +0000 (11:04 +0800)
committerKevron Rees <kevron_m_rees@linux.intel.com>
Thu, 7 Mar 2013 21:01:33 +0000 (13:01 -0800)
Signed-off-by: Andy Green <andy.green@linaro.org>
lib/libwebsockets.c

index 173c977..32f4a8d 100644 (file)
@@ -1630,11 +1630,11 @@ libwebsocket_create_context(struct lws_context_creation_info *info)
        context->options = info->options;
        /* to reduce this allocation, */
        context->max_fds = getdtablesize();
-       lwsl_notice(" max fd tracked: %u\n", context->max_fds);
-       lwsl_notice(" static allocation: %u bytes\n",
-               sizeof(struct libwebsocket_context) +
-               (sizeof(struct pollfd) * context->max_fds) +
-               (sizeof(struct libwebsocket *) * context->max_fds));
+       lwsl_notice(" static allocation: %u + (%u x %u fds) = %u bytes\n",
+               sizeof(struct libwebsocket_context),
+               sizeof(struct pollfd) + sizeof(struct libwebsocket *),
+               context->max_fds,
+               sizeof(struct libwebsocket_context) + ((sizeof(struct pollfd) + sizeof(struct libwebsocket *)) * context->max_fds));
 
        context->fds = (struct pollfd *)malloc(sizeof(struct pollfd) * context->max_fds);
        if (context->fds == NULL) {