Hello, On Mon, 5 Feb 2024 23:24:39 +0200 Clima Gabriel <clima.gabrielph...@gmail.com> wrote:
> Hello everyone, > > (the code is probably clearer and attached below) > This function modifies what ngx_connection_t->data points to. > ngx_connection_t->data is initially *ngx_http_connection_t. > The *ngx_http_connection_t is assigned to > ngx_http_v3_session_t->http_connection > And the *ngx_http_v3_session_t assigned to ngx_connection_t->data. > > Result: before ngx_connection_t->data is *ngx_http_connection_t > after ngx_connection_t->data is *ngx_http_v3_session_t In C, a pointer to struct can be cast to a pointer to the first member of that struct, as there is no padding before the first member per the standard. The first member of ngx_http_v3_session_t is *ngx_http_connection_t. Here is the commit where this was implemented. https://mailman.nginx.org/pipermail/nginx-devel/2023-September/BWH23FTMRUWCUZSNKXJJXEEN76ZYOK62.html [...] _______________________________________________ nginx mailing list nginx@nginx.org https://mailman.nginx.org/mailman/listinfo/nginx