blob: 3598859a903aba37aa8f8710f550d250ffac346d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
/* See LICENSE file for copyright and license details. */
#include "internals"
#include <stdlib.h>
#include <string.h>
void
zset(z_t a, z_t b)
{
if (zzero(b)) {
SET_SIGNUM(a, 0);
} else {
if (a->alloced < b->alloced) {
a->alloced = b->alloced;
a->chars = realloc(a->chars, b->alloced * sizeof(*(a->chars)));
}
a->sign = b->sign;
a->used = b->used;
memcpy(a->chars, b->chars, b->used * sizeof(*(a->chars)));
}
}
|