Library: Added buffer-size attribute for <alloc>
This commit is contained in:
parent
a3257349b9
commit
18668a52b9
|
@ -32,6 +32,9 @@
|
|||
<optional>
|
||||
<attribute name="arg"><ref name="ARGNO"/></attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="buffer-size"><ref name="DATA-BUFFER-SIZE"/></attribute>
|
||||
</optional>
|
||||
<ref name="DATA-NAME"/>
|
||||
</element>
|
||||
<element name="use"><ref name="DATA-EXTNAME"/></element>
|
||||
|
@ -458,6 +461,12 @@
|
|||
</data>
|
||||
</define>
|
||||
|
||||
<define name="DATA-BUFFER-SIZE">
|
||||
<data type="string">
|
||||
<param name="pattern">arg-value:[1-3]</param>
|
||||
</data>
|
||||
</define>
|
||||
|
||||
<define name="CONTAINER-ACTION">
|
||||
<choice>
|
||||
<value>resize</value>
|
||||
|
|
|
@ -7320,7 +7320,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
|
|||
<arg nr="2"/>
|
||||
</function>
|
||||
<memory>
|
||||
<alloc init="false">malloc</alloc>
|
||||
<alloc init="false" buffer-size="arg-value:1">malloc</alloc>
|
||||
<alloc init="true">calloc</alloc>
|
||||
<alloc init="false">aligned_alloc</alloc>
|
||||
<alloc init="false">valloc</alloc>
|
||||
|
|
|
@ -200,6 +200,13 @@ Library::Error Library::load(const tinyxml2::XMLDocument &doc)
|
|||
temp.arg = atoi(arg);
|
||||
else
|
||||
temp.arg = -1;
|
||||
|
||||
const char *bufferSize = memorynode->Attribute("buffer-size");
|
||||
if (bufferSize && std::strncmp(bufferSize, "arg-value:", 10) == 0)
|
||||
temp.bufferSizeArgValue = bufferSize[10] - '0';
|
||||
else
|
||||
temp.bufferSizeArgValue = -1;
|
||||
|
||||
mAlloc[memorynode->GetText()] = temp;
|
||||
} else if (memorynodename == "dealloc") {
|
||||
AllocFunc temp;
|
||||
|
|
|
@ -73,6 +73,7 @@ public:
|
|||
struct AllocFunc {
|
||||
int groupId;
|
||||
int arg;
|
||||
int bufferSizeArgValue;
|
||||
};
|
||||
|
||||
/** get allocation info for function */
|
||||
|
|
Loading…
Reference in New Issue