In libwebsockets library examples there is a variable of type struct lws_http_mount
initialized here. The stuct lws_http_mount
was declared here. Below is the snippet of its declaration and definition for convenience.
struct lws_http_mount {
const struct lws_http_mount *mount_next;
const char *mountpoint;
const char *origin;
const char *def;
const char *protocol;
const struct lws_protocol_vhost_options *cgienv;
const struct lws_protocol_vhost_options *extra_mimetypes;
const struct lws_protocol_vhost_options *interpret;
int cgi_timeout;
int cache_max_age;
unsigned int auth_mask;
unsigned int cache_reusable:1;
unsigned int cache_revalidate:1;
unsigned int cache_intermediaries:1;
unsigned char origin_protocol;
unsigned char mountpoint_len;
const char *basic_auth_login_file;
void *_unused[2];
};
static const struct lws_http_mount mount_localhost1 = {
/* .mount_next */ NULL,
/* .mountpoint */ "/",
/* .origin */ "./mount-origin-localhost1",
/* .def */ "index.html",
/* .protocol */ NULL,
/* .cgienv */ NULL,
/* .extra_mimetypes */ NULL,
/* .interpret */ NULL,
/* .cgi_timeout */ 0,
/* .cache_max_age */ 0,
/* .auth_mask */ 0,
/* .cache_reusable */ 0,
/* .cache_revalidate */ 0,
/* .cache_intermediaries */ 0,
/* .origin_protocol */ LWSMPRO_FILE,
/* .mountpoint_len */ 1,
/* .basic_auth_login_file */ NULL,
}
The member mountpoint
of this struct is of type const char*
. This has been initialized to "\"
in the variable mount_localhost1
. what will be the actual char array size allocated inside this struct for its member mountpoint
?
I only know that char array member declaration inside the struct should be done as char mountpoint[string_length]
instead of const char* mountpoint
.