feature add assert
This commit is contained in:
parent
b2b52861bf
commit
fae8944991
@ -54,6 +54,7 @@ CItemString::GenerateSetterDefinition(std::string message_id) const
|
||||
std::stringstream ss;
|
||||
// set_xxx_data
|
||||
ss << "void " << message_id << "_set_" << id() << "_data(" << message_id << "* message, const void* " << id() << ", int32_t " << id() << "_len) {" << std::endl;
|
||||
ss << " assert(" << id() << " || " << id() << "_len == 0);" << std::endl;
|
||||
ss << " char* new_" << id() << " = (char*)malloc(" << id() << "_len + 1);" << std::endl;
|
||||
ss << " if (new_" << id() << " == NULL) { return; }" << std::endl;
|
||||
ss << " memcpy(new_" << id() << ", " << id() << ", " << id() << "_len);" << std::endl;
|
||||
|
Loading…
Reference in New Issue
Block a user