Lines Matching refs:dest
1027 re_node_set_init_copy (re_node_set *dest, const re_node_set *src)
1029 dest->nelem = src->nelem;
1032 dest->alloc = dest->nelem;
1033 dest->elems = re_malloc (int, dest->alloc);
1034 if (BE (dest->elems == NULL, 0))
1036 dest->alloc = dest->nelem = 0;
1039 memcpy (dest->elems, src->elems, src->nelem * sizeof (int));
1042 re_node_set_init_empty (dest);
1048 Note: We assume dest->elems is NULL, when dest->alloc is 0. */
1052 re_node_set_add_intersect (re_node_set *dest, const re_node_set *src1,
1059 /* We need dest->nelem + 2 * elems_in_intersection; this is a
1061 if (src1->nelem + src2->nelem + dest->nelem > dest->alloc)
1063 int new_alloc = src1->nelem + src2->nelem + dest->alloc;
1064 int *new_elems = re_realloc (dest->elems, int, new_alloc);
1067 dest->elems = new_elems;
1068 dest->alloc = new_alloc;
1073 sbase = dest->nelem + src1->nelem + src2->nelem;
1076 id = dest->nelem - 1;
1082 while (id >= 0 && dest->elems[id] > src1->elems[i1])
1085 if (id < 0 || dest->elems[id] != src1->elems[i1])
1086 dest->elems[--sbase] = src1->elems[i1];
1105 id = dest->nelem - 1;
1106 is = dest->nelem + src1->nelem + src2->nelem - 1;
1112 dest->nelem += delta;
1116 if (dest->elems[is] > dest->elems[id])
1119 dest->elems[id + delta--] = dest->elems[is--];
1126 dest->elems[id + delta] = dest->elems[id];
1133 memcpy (dest->elems, dest->elems + sbase, delta * sizeof (int));
1143 re_node_set_init_union (re_node_set *dest, const re_node_set *src1,
1149 dest->alloc = src1->nelem + src2->nelem;
1150 dest->elems = re_malloc (int, dest->alloc);
1151 if (BE (dest->elems == NULL, 0))
1157 return re_node_set_init_copy (dest, src1);
1159 return re_node_set_init_copy (dest, src2);
1161 re_node_set_init_empty (dest);
1168 dest->elems[id++] = src2->elems[i2++];
1173 dest->elems[id++] = src1->elems[i1++];
1177 memcpy (dest->elems + id, src1->elems + i1,
1183 memcpy (dest->elems + id, src2->elems + i2,
1187 dest->nelem = id;
1196 re_node_set_merge (re_node_set *dest, const re_node_set *src)
1201 if (dest->alloc < 2 * src->nelem + dest->nelem)
1203 int new_alloc = 2 * (src->nelem + dest->alloc);
1204 int *new_buffer = re_realloc (dest->elems, int, new_alloc);
1207 dest->elems = new_buffer;
1208 dest->alloc = new_alloc;
1211 if (BE (dest->nelem == 0, 0))
1213 dest->nelem = src->nelem;
1214 memcpy (dest->elems, src->elems, src->nelem * sizeof (int));
1220 for (sbase = dest->nelem + 2 * src->nelem,
1221 is = src->nelem - 1, id = dest->nelem - 1; is >= 0 && id >= 0; )
1223 if (dest->elems[id] == src->elems[is])
1225 else if (dest->elems[id] < src->elems[is])
1226 dest->elems[--sbase] = src->elems[is--];
1227 else /* if (dest->elems[id] > src->elems[is]) */
1235 memcpy (dest->elems + sbase, src->elems, (is + 1) * sizeof (int));
1238 id = dest->nelem - 1;
1239 is = dest->nelem + 2 * src->nelem - 1;
1246 dest->nelem += delta;
1249 if (dest->elems[is] > dest->elems[id])
1252 dest->elems[id + delta--] = dest->elems[is--];
1259 dest->elems[id + delta] = dest->elems[id];
1263 memcpy (dest->elems, dest->elems + sbase,