Clang was complaining about these (#2421)

Checking if first char is null should be faster than strlen
This commit is contained in:
Michael Cook (mackal)
2022-09-03 17:36:45 -04:00
committed by GitHub
parent 89382d5e4a
commit d8134df679
+4 -4
View File
@@ -144,8 +144,8 @@ Object::Object(Client* client, const EQ::ItemInstance* inst)
// Set object name
if (inst) {
const EQ::ItemData* item = inst->GetItem();
if (item && item->IDFile) {
if (strlen(item->IDFile) == 0) {
if (item) {
if (item->IDFile[0] == '\0') {
strcpy(m_data.object_name, DEFAULT_OBJECT_NAME);
}
else {
@@ -200,8 +200,8 @@ Object::Object(const EQ::ItemInstance *inst, float x, float y, float z, float he
// Set object name
if (inst) {
const EQ::ItemData* item = inst->GetItem();
if (item && item->IDFile) {
if (strlen(item->IDFile) == 0) {
if (item) {
if (item->IDFile[0] == '\0') {
strcpy(m_data.object_name, DEFAULT_OBJECT_NAME);
}
else {