MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / PiuContent_set_nameAux

Function PiuContent_set_nameAux

modules/piu/All/piuContent.c:1132–1152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1130}
1131
1132void PiuContent_set_nameAux(PiuContent* self)
1133{
1134 xsMachine *the = (*self)->the;
1135 size_t nameLength = (xsUndefinedType == xsTypeOf(xsResult)) ? 0 : PiuRecordSize(1 + c_strlen(fxToString(the, &xsResult)));
1136 size_t current = (*self)->nameOffset ? (*self)->nameOffset : (*self)->recordSize;
1137
1138 void *chunk = fxRenewChunk(the, *self, (xsIntegerValue)(current + nameLength));
1139 if (!chunk) {
1140 chunk = fxNewChunk(the, (xsIntegerValue)(current + nameLength));
1141 c_memcpy(chunk, *self, current);
1142 *self = chunk;
1143 }
1144
1145 (*self)->recordSize = (uint32_t)(current + nameLength);
1146 if (nameLength) {
1147 (*self)->nameOffset = (uint32_t)current;
1148 c_strcpy(((char *)*self) + current, fxToString(the, &xsResult));
1149 }
1150 else
1151 (*self)->nameOffset = 0;
1152}
1153
1154void PiuContent_set_offset(xsMachine *the)
1155{

Callers 2

PiuContentDictionaryFunction · 0.85
PiuContent_set_nameFunction · 0.85

Calls 3

fxToStringFunction · 0.85
fxRenewChunkFunction · 0.85
fxNewChunkFunction · 0.85

Tested by

no test coverage detected