diff --git a/camera/drivers/video4linux2.c b/camera/drivers/video4linux2.c index 28e8376cdf..cc5d57110c 100644 --- a/camera/drivers/video4linux2.c +++ b/camera/drivers/video4linux2.c @@ -402,7 +402,7 @@ static bool v4l_poll(void *data, if (preprocess_image(data)) { - if (frame_raw_cb != NULL) + if (frame_raw_cb) frame_raw_cb(v4l->buffer_output, v4l->width, v4l->height, v4l->width * 4); return true; diff --git a/frontend/drivers/platform_unix.c b/frontend/drivers/platform_unix.c index be649a0316..e7ac2bc24b 100644 --- a/frontend/drivers/platform_unix.c +++ b/frontend/drivers/platform_unix.c @@ -164,7 +164,7 @@ int system_property_get(const char *command, while (!feof(pipe)) { - if (fgets(buffer, 128, pipe) != NULL) + if (fgets(buffer, 128, pipe)) { int curlen = strlen(buffer); @@ -306,11 +306,11 @@ static void* onSaveInstanceState( while (!android_app->stateSaved) scond_wait(android_app->cond, android_app->mutex); - if (android_app->savedState != NULL) + if (android_app->savedState) { - savedState = android_app->savedState; - *outLen = android_app->savedStateSize; - android_app->savedState = NULL; + savedState = android_app->savedState; + *outLen = android_app->savedStateSize; + android_app->savedState = NULL; android_app->savedStateSize = 0; } @@ -451,9 +451,9 @@ static struct android_app* android_app_create(ANativeActivity* activity, android_app->mutex = slock_new(); android_app->cond = scond_new(); - if (savedState != NULL) + if (savedState) { - android_app->savedState = malloc(savedStateSize); + android_app->savedState = malloc(savedStateSize); android_app->savedStateSize = savedStateSize; memcpy(android_app->savedState, savedState, savedStateSize); } @@ -1783,10 +1783,10 @@ static void free_saved_state(struct android_app* android_app) { slock_lock(android_app->mutex); - if (android_app->savedState != NULL) + if (android_app->savedState) { free(android_app->savedState); - android_app->savedState = NULL; + android_app->savedState = NULL; android_app->savedStateSize = 0; } @@ -2414,7 +2414,7 @@ enum retro_language frontend_unix_get_user_language(void) #else char *envvar = getenv("LANG"); - if (envvar != NULL) + if (envvar) lang = rarch_get_language_from_iso(envvar); #endif #endif diff --git a/gfx/common/dbus_common.c b/gfx/common/dbus_common.c index 7270510337..68c4838187 100644 --- a/gfx/common/dbus_common.c +++ b/gfx/common/dbus_common.c @@ -93,7 +93,7 @@ bool dbus_screensaver_inhibit(void) reply = dbus_connection_send_with_reply_and_block(dbus_connection, msg, 300, NULL); - if (reply != NULL) + if (reply) { if (!dbus_message_get_args(reply, NULL, DBUS_TYPE_UINT32, &dbus_screensaver_cookie, diff --git a/gfx/drivers/dispmanx_gfx.c b/gfx/drivers/dispmanx_gfx.c index 941065a038..20fbfaaec4 100644 --- a/gfx/drivers/dispmanx_gfx.c +++ b/gfx/drivers/dispmanx_gfx.c @@ -457,7 +457,7 @@ static bool dispmanx_gfx_frame(void *data, const void *frame, unsigned width, _dispvars->core_pitch = pitch; _dispvars->aspect_ratio = aspect; - if (_dispvars->main_surface != NULL) + if (_dispvars->main_surface) dispmanx_surface_free(_dispvars, &_dispvars->main_surface); /* Internal resolution or ratio has changed, so we need diff --git a/gfx/drivers/drm_gfx.c b/gfx/drivers/drm_gfx.c index 3f18f46410..42e426918a 100644 --- a/gfx/drivers/drm_gfx.c +++ b/gfx/drivers/drm_gfx.c @@ -770,7 +770,7 @@ static bool drm_gfx_frame(void *data, const void *frame, unsigned width, _drmvars->core_height = height; _drmvars->core_pitch = pitch; - if (_drmvars->main_surface != NULL) + if (_drmvars->main_surface) drm_surface_free(_drmvars, &_drmvars->main_surface); /* We need to recreate the main surface and it's pages (buffers). */ diff --git a/gfx/drivers/exynos_gfx.c b/gfx/drivers/exynos_gfx.c index d81e29b1ba..cbf5862383 100644 --- a/gfx/drivers/exynos_gfx.c +++ b/gfx/drivers/exynos_gfx.c @@ -247,7 +247,7 @@ static void exynos_clean_up_pages(struct exynos_page *p, unsigned cnt) for (i = 0; i < cnt; ++i) { - if (p[i].bo != NULL) + if (p[i].bo) { if (p[i].buf_id != 0) drmModeRmFB(p[i].buf_id, p[i].bo->handle); @@ -1271,7 +1271,7 @@ static void exynos_gfx_free(void *data) free(pdata); - if (vid->font != NULL && vid->font_driver != NULL) + if (vid->font && vid->font_driver) vid->font_driver->free(vid->font); free(vid); diff --git a/gfx/drivers_context/x_ctx.c b/gfx/drivers_context/x_ctx.c index 9446253899..30923add44 100644 --- a/gfx/drivers_context/x_ctx.c +++ b/gfx/drivers_context/x_ctx.c @@ -132,7 +132,7 @@ static int GLXExtensionSupported(Display *dpy, const char *extension) const char *client_extensions = glXGetClientString(dpy, GLX_EXTENSIONS); const char *pos = strstr(extensionsString, extension); - if ( (pos != NULL) && + if ( pos && (pos == extensionsString || pos[-1] == ' ') && (pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0') ) @@ -141,7 +141,7 @@ static int GLXExtensionSupported(Display *dpy, const char *extension) pos = strstr(client_extensions, extension); if ( - (pos != NULL) && + pos && (pos == extensionsString || pos[-1] == ' ') && (pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0') ) @@ -878,7 +878,7 @@ static bool gfx_ctx_x_set_video_mode(void *data, x->g_glx_win, x->g_glx_win, x->g_ctx); version = (const char*)glGetString(GL_VERSION); - if (strstr(version, " Mesa ") != NULL || !x->g_core_es) + if (strstr(version, " Mesa ") || !x->g_core_es) { /* we are done, break switch case */ XSetErrorHandler(old_handler); diff --git a/input/drivers_joypad/udev_joypad.c b/input/drivers_joypad/udev_joypad.c index 8fb55b3995..e60a8b24ad 100644 --- a/input/drivers_joypad/udev_joypad.c +++ b/input/drivers_joypad/udev_joypad.c @@ -582,7 +582,7 @@ static bool udev_joypad_init(void *data) struct udev_device *dev = udev_device_new_from_syspath(udev_joypad_fd, name); const char *devnode = udev_device_get_devnode(dev); - if (devnode != NULL) + if (devnode) udev_check_device(dev, devnode); udev_device_unref(dev); } diff --git a/input/drivers_joypad/wiiu_joypad.c b/input/drivers_joypad/wiiu_joypad.c index b15746c48f..c490436419 100644 --- a/input/drivers_joypad/wiiu_joypad.c +++ b/input/drivers_joypad/wiiu_joypad.c @@ -45,7 +45,7 @@ static bool wiiu_joypad_query_pad(unsigned pad) { return ready && pad < MAX_USERS && - pad_drivers[pad] != NULL && + pad_drivers[pad] && pad_drivers[pad]->query_pad(pad); } diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 6f92962843..30f6239e24 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -950,7 +950,7 @@ int setting_set_with_string_representation(rarch_setting_t* setting, case ST_STRING: case ST_STRING_OPTIONS: case ST_ACTION: - if ( setting->value.target.string != NULL) + if (setting->value.target.string) strlcpy(setting->value.target.string, value, setting->size); break; case ST_BOOL: diff --git a/network/netplay/netplay_room_parse.c b/network/netplay/netplay_room_parse.c index 6a274c467e..e910bbba88 100644 --- a/network/netplay/netplay_room_parse.c +++ b/network/netplay/netplay_room_parse.c @@ -436,7 +436,7 @@ struct netplay_room* netplay_room_get(int index) if (index < 0) return NULL; - while (room != NULL) + while (room) { if (cur == index) break; @@ -461,7 +461,7 @@ int netplay_rooms_get_count(void) if (!room) return count; - while(room != NULL) + while (room) { count++; diff --git a/wifi/drivers/connmanctl.c b/wifi/drivers/connmanctl.c index c83f3ddd1f..77437ed621 100644 --- a/wifi/drivers/connmanctl.c +++ b/wifi/drivers/connmanctl.c @@ -111,7 +111,7 @@ static void connmanctl_tether_toggle(bool switch_on, char* apname, char* passkey RARCH_LOG("[CONNMANCTL] Tether toggle: command: \"%s\"\n", command); - while (fgets(output, sizeof(output), command_file) != NULL) + while (fgets(output, sizeof(output), command_file)) { if (output[strlen(output)-1] == '\n') output[strlen(output)-1] = '\0'; @@ -176,7 +176,7 @@ static void connmanctl_scan(void) MESSAGE_QUEUE_CATEGORY_INFO); serv_file = popen("connmanctl services", "r"); - while (fgets (line, 512, serv_file) != NULL) + while (fgets(line, 512, serv_file)) { size_t len = strlen(line); if (len > 0 && line[len-1] == '\n') @@ -236,7 +236,7 @@ static bool connmanctl_ssid_is_online(unsigned i) command_file = popen(command, "r"); - while (fgets (ln, 512, command_file) != NULL) + while (fgets(ln, 512, command_file)) { connman_cache[i] = true; return true; @@ -333,7 +333,7 @@ static bool connmanctl_connect_ssid(unsigned idx, const char* passphrase) command_file = popen(command, "r"); - while (fgets (ln, sizeof(ln), command_file) != NULL) + while (fgets(ln, sizeof(ln), command_file)) { #ifdef HAVE_GFX_WIDGETS if (!gfx_widgets_ready()) @@ -414,7 +414,7 @@ static void connmanctl_get_connected_servicename(char* servicename, size_t buffe RARCH_LOG("[CONNMANCTL] Testing configured services for activity: command: \"%s\"\n", command); - while (fgets(temp, buffersize, command_file) != NULL) + while (fgets(temp, buffersize, command_file)) { if (strlen(temp) > 0) if (temp[strlen(temp)-1] == '\n') @@ -547,7 +547,7 @@ static void connmanctl_tether_start_stop(bool start, char* configfile) RARCH_LOG("[CONNMANCTL] Tether start stop: parsing command: \"%s\"\n", command); - while (fgets(ln, sizeof(ln), command_file) != NULL) + while (fgets(ln, sizeof(ln), command_file)) { i++; if (strlen(ln) > 1) @@ -632,7 +632,7 @@ static void connmanctl_tether_start_stop(bool start, char* configfile) RARCH_LOG("[CONNMANCTL] Tether start stop: disconnecting from service \"%s\", command: \"%s\"\n", service, command); - while (fgets(ln, sizeof(ln), command_file) != NULL) + while (fgets(ln, sizeof(ln), command_file)) { if (ln[strlen(ln)-1] == '\n') ln[strlen(ln)-1] = '\0';