MCPcopy Create free account
hub / github.com/IoLanguage/io / UArray_replace_with_

Function UArray_replace_with_

libs/basekit/source/UArray_string.c:40–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40void UArray_replace_with_(UArray *self, const UArray *a1, const UArray *a2) {
41 long i;
42 size_t start = 0;
43 UArray visible = UArray_stackRange(self, start, self->size);
44
45 if (UArray_size(a1) == 0)
46 return;
47
48 while ((i = UArray_find_(&visible, a1)) != -1) {
49 size_t index = start + i;
50 UArray_removeRange(self, index, a1->size);
51 UArray_at_putAll_(self, index, a2);
52 start = index + a2->size;
53 visible = UArray_stackRange(self, start, self->size - start);
54 }
55 UArray_changed(self);
56}
57
58BASEKIT_API void UArray_replaceCString_withCString_(UArray *self,
59 const char *s1,

Callers 3

UArray_remove_Function · 0.85
IoSeq_mutable.cFile · 0.85

Calls 6

UArray_stackRangeFunction · 0.85
UArray_sizeFunction · 0.85
UArray_find_Function · 0.85
UArray_removeRangeFunction · 0.85
UArray_at_putAll_Function · 0.85
UArray_changedFunction · 0.85

Tested by

no test coverage detected