removed lots of asserts
Some of them relied on the side effects of evaluating their argument but
for most of them it just makes more sense to use CHECK.
diff --git a/aos/linux_code/starter/netconsole.cc b/aos/linux_code/starter/netconsole.cc
index 4d32afe..c4ca5b9 100644
--- a/aos/linux_code/starter/netconsole.cc
+++ b/aos/linux_code/starter/netconsole.cc
@@ -7,7 +7,6 @@
#include <fcntl.h>
#include <pthread.h>
#include <sys/stat.h>
-#include <assert.h>
#include "aos/common/logging/logging_impl.h"
#include "aos/common/util/inet_addr.h"
@@ -33,8 +32,8 @@
char buffer[32768];
ssize_t position = 0;
while (true) {
- assert(position >= 0);
- assert(position <= static_cast<ssize_t>(sizeof(buffer)));
+ CHECK_GE(position, 0);
+ CHECK_LE(position, static_cast<ssize_t>(sizeof(buffer)));
if (position != sizeof(buffer)) {
ssize_t read_bytes;
bool good_data = true;
@@ -73,7 +72,7 @@
}
}
if (to_copy->source_address != nullptr) {
- assert(header.msg_namelen >= sizeof(struct sockaddr_in));
+ CHECK_GE(header.msg_namelen, sizeof(struct sockaddr_in));
if (to_copy->source_address->sin_port != hton<uint16_t>(0)) {
if (sender_address.sin_port !=
to_copy->source_address->sin_port) {
@@ -104,8 +103,8 @@
}
}
- assert(position >= 0);
- assert(position <= static_cast<ssize_t>(sizeof(buffer)));
+ CHECK_GE(position, 0);
+ CHECK_LE(position, static_cast<ssize_t>(sizeof(buffer)));
if (position > 0) {
ssize_t sent_bytes = write(to_copy->output, buffer, position);
if (sent_bytes == -1) {