quakeforge/libs/video/renderer/vulkan/vkgen/vkfieldreadonly.r
Bill Currie 68b5cd89d2 [vkgen] Plug a pile of ruamoko memory leaks
While the previous cleanup took care of the C side, it turns out vkgen
was leaking property list items all over the place, but they were
cleaned up by the shutdown code.
2023-03-13 11:26:13 +09:00

53 lines
996 B
R

#include <PropertyList.h>
#include <string.h>
#include "vkfieldreadonly.h"
#include "vkfieldtype.h"
#include "vkgen.h"
#include "vktype.h"
@implementation ReadOnlyField
-init:(PLItem *) item struct:(Struct *)strct field:(string)fname
{
self = [super init:item struct:strct field:fname];
if (!self) {
return self;
}
PLItem *desc = [item getObjectForKey:"type"];
type = [[FieldType fieldType:[desc getObjectAtIndex:1]] retain];
value_field = str_hold ([[item getObjectForKey:"value"] string]);
return self;
}
-(void) dealloc
{
[type release];
str_free (value_field);
[super dealloc];
}
-writeParseData
{
return self;
}
-writeField
{
string parse_type = [FieldType anyType];
fprintf (output_file, "\t{\"%s\", 0, %s, parse_%s, 0},\n",
field_name, parse_type, "ignore");
return self;
}
-writeSymbol
{
fprintf (output_file,
"\t{\"%s\", %s, (void *) field_offset (%s, %s)},\n",
field_name, [type exprType], struct_name, value_field);
return self;
}
@end