feature add assert
Some checks failed
build-crpc / build (Debug, host.toolchain.cmake) (push) Failing after 13m5s
build-crpc / build (Release, host.toolchain.cmake) (push) Failing after 13m9s

This commit is contained in:
tqcq 2023-12-04 16:23:02 +08:00
parent b2b52861bf
commit fae8944991

View File

@ -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;