static ngx_int_t
ngx_http_upstream_addr_variable(ngx_http_request_t *r,
    ngx_http_variable_value_t *v, uintptr_t data)
{
    u_char                     *p;
    size_t                      len;
    ngx_uint_t                  i;
    ngx_http_upstream_state_t  *state;
    v->valid = 1;
    v->no_cacheable = 0;
    v->not_found = 0;
    if (r->upstream_states == NULL || r->upstream_states->nelts == 0) {
        v->not_found = 1;
        return NGX_OK;
    }
    len = 0;
    state = r->upstream_states->elts;
    for (i = 0; i < r->upstream_states->nelts; i++) {
        if (state[i].peer) {
            len += state[i].peer->len + 2;
        } else {
            len += 3;
        }
    }
    p = ngx_pnalloc(r->pool, len);
    if (p == NULL) {
        return NGX_ERROR;
    }
    v->data = p;
    i = 0;
    for ( ;; ) {
        if (state[i].peer) {
            p = ngx_cpymem(p, state[i].peer->data, state[i].peer->len);
        }
        if (++i == r->upstream_states->nelts) {
            break;
        }
        if (state[i].peer) {
            *p++ = ',';
            *p++ = ' ';
        } else {
            *p++ = ' ';
            *p++ = ':';
            *p++ = ' ';
            if (++i == r->upstream_states->nelts) {
                break;
            }
            continue;
        }
    }
    v->len = p - v->data;
    return NGX_OK;
}
["static ngx_int_t\nngx_http_upstream_addr_variable(ngx_http_request_t *r,\n    ngx_http_variable_value_t *v, uintptr_t data)\n{\n    u_char                     *p;\n    size_t                      len;\n    ngx_uint_t                  i;\n    ngx_http_upstream_state_t  *state;\n    v->valid = 1;\n    v->no_cacheable = 0;\n    v->not_found = 0;\n    if (r->upstream_states == NULL || r->upstream_states->nelts == 0) {\n        v->not_found = 1;\n        return NGX_OK;\n    }\n    len = 0;\n    state = r->upstream_states->elts;\n    for (i = 0; i < r->upstream_states->nelts; i++) {\n        if (state[i].peer) {\n            len += state[i].peer->len + 2;\n        } else {\n            len += 3;\n        }\n    }\n    p = ngx_pnalloc(r->pool, len);\n    if (p == NULL) {\n        return NGX_ERROR;\n    }\n    v->data = p;\n    i = 0;\n    for ( ;; ) {\n        if (state[i].peer) {\n            p = ngx_cpymem(p, state[i].peer->data, state[i].peer->len);\n        }\n        if (++i == r->upstream_states->nelts) {\n            break;\n        }\n        if (state[i].peer) {\n            *p++ = ',';\n            *p++ = ' ';\n        } else {\n            *p++ = ' ';\n            *p++ = ':';\n            *p++ = ' ';\n            if (++i == r->upstream_states->nelts) {\n                break;\n            }\n            continue;\n        }\n    }\n    v->len = p - v->data;\n    return NGX_OK;\n}", 'void *\nngx_pnalloc(ngx_pool_t *pool, size_t size)\n{\n    u_char      *m;\n    ngx_pool_t  *p;\n    if (size <= pool->max) {\n        p = pool->current;\n        do {\n            m = p->d.last;\n            if ((size_t) (p->d.end - m) >= size) {\n                p->d.last = m + size;\n                return m;\n            }\n            p = p->d.next;\n        } while (p);\n        return ngx_palloc_block(pool, size);\n    }\n    return ngx_palloc_large(pool, size);\n}']