the nullptr update
This commit is contained in:
@@ -70,7 +70,7 @@ static void aio_set_pump_mode(libusb_device_handle* dev, const enum aio_pump_mod
|
||||
}
|
||||
|
||||
static void aio_set_color(libusb_device_handle* dev, const enum aio_color_mode_t mode, const uint8_t speed, const struct rgb_t* colors, const uint8_t color_count) {
|
||||
if (colors == NULL) // NOLINT no its not
|
||||
if (colors == nullptr) // NOLINT no its not
|
||||
return;
|
||||
|
||||
constexpr uint8_t modes[] = {0x52, 0x55, 0x55, 0x58};
|
||||
@@ -132,7 +132,7 @@ static void aio_set_fan_curve(libusb_device_handle* dev, const struct curve_poin
|
||||
void aio_detect(struct aio_t *aio, const float t_quiet, const float t_balanced) {
|
||||
libusb_init(nullptr);
|
||||
aio->handle = libusb_open_device_with_vid_pid(nullptr, AIO_USB_VID, AIO_USB_PID);
|
||||
if (aio->handle == NULL) {
|
||||
if (aio->handle == nullptr) {
|
||||
applog(LOG_ERR, "Can't open AIO USB device %x:%x", AIO_USB_VID, AIO_USB_PID);
|
||||
return;
|
||||
}
|
||||
@@ -160,7 +160,7 @@ void aio_detect(struct aio_t *aio, const float t_quiet, const float t_balanced)
|
||||
}
|
||||
|
||||
void aio_update(struct aio_t *aio) {
|
||||
if (aio->handle == NULL)
|
||||
if (aio->handle == nullptr)
|
||||
return;
|
||||
|
||||
aio_usb_claim(aio->handle);
|
||||
|
||||
@@ -83,7 +83,7 @@ static void *sensors_thread(void *arg) {
|
||||
|
||||
aio_close(&sensors->aio);
|
||||
applog(LOG_WRN, "sensors thread stopped");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static void *display_thread(void *arg) {
|
||||
@@ -168,7 +168,7 @@ static void *display_thread(void *arg) {
|
||||
lcd_flush_buf(&lcd);
|
||||
lcd_close(&lcd);
|
||||
applog(LOG_WRN, "display thread stopped");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
@@ -181,7 +181,7 @@ int main(void) {
|
||||
|
||||
/* malloc memory for the struct */
|
||||
struct sensors_t *sensors = malloc(sizeof(*sensors)); // no actual point in mallocing and it is ever so sligtly slower to access heap vs stack, but its cool
|
||||
if (sensors == NULL) {
|
||||
if (sensors == nullptr) {
|
||||
applog(LOG_ERR, "can't allocate mem for the sensor struct. You don't got %lu bytes bro?", sizeof(*sensors));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ void sys_get_ram(struct memory_t *ram) {
|
||||
memset(ram, 0, sizeof(struct memory_t)); // zero out all values so we dont break out of the loop early
|
||||
|
||||
FILE *f = fopen("/proc/meminfo", "r");
|
||||
if (f == NULL)
|
||||
if (f == nullptr)
|
||||
return;
|
||||
|
||||
while (fgets(buf, sizeof(buf), f)) {
|
||||
|
||||
@@ -90,7 +90,7 @@ inline size_t read_file(const char *dir, const char *file, char *buffer, const s
|
||||
strcpy(nt, file); // copy to the null terminator of prev copy, append basically
|
||||
const int fd = open(path, O_RDONLY | O_CLOEXEC);
|
||||
if (fd < 0) {
|
||||
if (buffer != NULL) // if its null means we're just checking if it exists at all, so dont log it
|
||||
if (buffer != nullptr) // if its null means we're just checking if it exists at all, so dont log it
|
||||
applog(LOG_ERR, "Error reading %s", path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user