1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_main.h>
8

--- 47 unchanged lines hidden (view full) ---

56 nxt_memcpy(dst->start, src->start, src->length);
57 dst->length = src->length;
58
59 return dst;
60}
61
62
63/*
64 * nxt_str_copy() creates a C style zero-terminated copy of a source
64 * nxt_str_cstrz() creates a C style zero-terminated copy of a source
65 * nxt_str_t. The function is intended to create strings suitable
66 * for libc and kernel interfaces so result is pointer to char instead
67 * of u_char to minimize casts. The copy is aligned to 2 bytes thus
68 * the lowest bit may be used as marker.
69 */
70
71char *
72nxt_str_copy(nxt_mp_t *mp, const nxt_str_t *src)
72nxt_str_cstrz(nxt_mp_t *mp, const nxt_str_t *src)
73{
74 char *p, *dst;
75
76 dst = nxt_mp_align(mp, 2, src->length + 1);
77
78 if (nxt_fast_path(dst != NULL)) {
79 p = nxt_cpymem(dst, src->start, src->length);
80 *p = '\0';

--- 238 unchanged lines hidden ---