static in_addr_t *
ngx_resolver_rotate(ngx_resolver_t *r, in_addr_t *src, ngx_uint_t n)
{
    void        *dst, *p;
    ngx_uint_t   j;
    dst = ngx_resolver_alloc(r, n * sizeof(in_addr_t));
    j = ngx_random() % n;
    if (j == 0) {
        ngx_memcpy(dst, src, n * sizeof(in_addr_t));
        return dst;
    }
    p = ngx_cpymem(dst, &src[j], (n - j) * sizeof(in_addr_t));
    ngx_memcpy(p, src, j * sizeof(in_addr_t));
    return dst;
}
['static in_addr_t *\nngx_resolver_rotate(ngx_resolver_t *r, in_addr_t *src, ngx_uint_t n)\n{\n    void        *dst, *p;\n    ngx_uint_t   j;\n    dst = ngx_resolver_alloc(r, n * sizeof(in_addr_t));\n    j = ngx_random() % n;\n    if (j == 0) {\n        ngx_memcpy(dst, src, n * sizeof(in_addr_t));\n        return dst;\n    }\n    p = ngx_cpymem(dst, &src[j], (n - j) * sizeof(in_addr_t));\n    ngx_memcpy(p, src, j * sizeof(in_addr_t));\n    return dst;\n}', 'static void *\nngx_resolver_alloc(ngx_resolver_t *r, size_t size)\n{\n    u_char  *p;\n    p = ngx_alloc(size, r->log);\n    return p;\n}', 'void *\nngx_alloc(size_t size, ngx_log_t *log)\n{\n    void  *p;\n    p = malloc(size);\n    if (p == NULL) {\n        ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,\n                      "malloc(%uz) failed", size);\n    }\n    ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, log, 0, "malloc: %p:%uz", p, size);\n    return p;\n}']