rendered paste body unsigned short vatCounter;
for(vatCounter=0;vatCounter<stringAmount;vatCounter++){
if(strcmp((*(stringPointer+vatCounter)).name,stringName)==0){
if(stringPointer[vatCounter].size!=stringSize){
if(stringPointer[vatCounter].handle)HeapUnlock(stringPointer[vatCounter].handle);
if((stringPointer[vatCounter].handle=HeapRealloc(stringPointer[vatCounter].handle,stringSize))==H_NULL)programError("Error reallocating memory");
if(stringPointer[vatCounter].handle)HeapLock(stringPointer[vatCounter].handle);
stringPointer[vatCounter].value=HeapDeref(stringPointer[vatCounter].handle);
stringPointer[vatCounter].size=stringSize;
}
memcpy(stringPointer[vatCounter].value,stringValue,stringSize);
return;
}
}
// If the variable doesn't exist
stringAmount++;
if(stringHandle)HeapUnlock(stringHandle);
if((stringHandle=HeapRealloc(stringHandle,stringAmount*sizeof(string)))==H_NULL)programError("Error reallocating memory");
if(stringHandle)HeapLock(stringHandle);
else programError("Invalid handle");
stringPointer=HeapDeref(stringHandle);
// OK, fine, maybe I should increment stringAmount later, I don't care right now
if(stringPointer[stringAmount-1].handle)HeapUnlock(stringPointer[stringAmount-1].handle);
if((stringPointer[stringAmount-1].handle=HeapAlloc(stringSize))==H_NULL)programError("Error reallocating memory");
if(stringPointer[stringAmount-1].handle)HeapLock(stringPointer[stringAmount-1].handle);
stringPointer[stringAmount-1].value=HeapDeref(stringPointer[stringAmount-1].handle);
memcpy(stringPointer[stringAmount-1].value,stringValue,stringSize);
stringPointer[stringAmount-1].size=stringSize;
memcpy(stringPointer[stringAmount-1].name,stringName,8);
}