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

Function UArray_escape

libs/basekit/source/UArray_string.c:333–377  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

331}
332
333void UArray_escape(UArray *self) {
334 UArray *out = UArray_new();
335 out->itemType = self->itemType;
336 out->itemSize = self->itemSize;
337
338 UARRAY_FOREACH(
339 self, i, v, switch ((int)v) {
340 case '"':
341 UArray_appendCString_(out, "\\\"");
342 break;
343 case '\a':
344 UArray_appendCString_(out, "\\a");
345 break;
346 case '\b':
347 UArray_appendCString_(out, "\\b");
348 break;
349 case '\f':
350 UArray_appendCString_(out, "\\f");
351 break;
352 case '\n':
353 UArray_appendCString_(out, "\\n");
354 break;
355 case '\r':
356 UArray_appendCString_(out, "\\r");
357 break;
358 case '\t':
359 UArray_appendCString_(out, "\\t");
360 break;
361 case '\v':
362 UArray_appendCString_(out, "\\v");
363 break;
364 case '\0':
365 UArray_appendCString_(out, "\\0");
366 break;
367 case '\\':
368 UArray_appendCString_(out, "\\\\");
369 break;
370 default:
371 UArray_appendLong_(out, v);
372 });
373
374 UArray_swapWith_(self, out);
375 UArray_free(out);
376 UArray_changed(self);
377}
378
379void UArray_unescape(UArray *self) {
380 size_t getIndex = 0;

Callers 1

IoSeq_mutable.cFile · 0.85

Calls 6

UArray_newFunction · 0.85
UArray_appendCString_Function · 0.85
UArray_appendLong_Function · 0.85
UArray_swapWith_Function · 0.85
UArray_freeFunction · 0.85
UArray_changedFunction · 0.85

Tested by

no test coverage detected