Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ce09723

Browse files
committed
Note for self: -O1+ strips out expressions surrounded by assert()
1 parent b974f44 commit ce09723

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/core/desktopfile/desktopfile.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,14 @@ namespace linuxdeploy {
173173
DesktopFileEntry entry;
174174

175175
// this should never return false
176-
assert(getEntry(section, key, entry));
176+
auto entryExists = getEntry(section, key, entry);
177+
assert(entryExists);
177178

178179
ldLog() << LD_WARNING << "Key exists, not modified:" << key << "(current value:" << entry.value() << LD_NO_SPACE << ")" << std::endl;
179180
rv = false;
180181
} else {
181-
assert(!setEntry(section, std::move(DesktopFileEntry(key, value))));
182+
auto entrySet = setEntry(section, DesktopFileEntry(key, value));
183+
assert(entrySet);
182184
}
183185
};
184186

0 commit comments

Comments
 (0)