Cleanup != NULL comparisons
This commit is contained in:
parent
6d37d014a0
commit
ad1aa59ce1
|
@ -402,7 +402,7 @@ static bool v4l_poll(void *data,
|
||||||
|
|
||||||
if (preprocess_image(data))
|
if (preprocess_image(data))
|
||||||
{
|
{
|
||||||
if (frame_raw_cb != NULL)
|
if (frame_raw_cb)
|
||||||
frame_raw_cb(v4l->buffer_output, v4l->width,
|
frame_raw_cb(v4l->buffer_output, v4l->width,
|
||||||
v4l->height, v4l->width * 4);
|
v4l->height, v4l->width * 4);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -164,7 +164,7 @@ int system_property_get(const char *command,
|
||||||
|
|
||||||
while (!feof(pipe))
|
while (!feof(pipe))
|
||||||
{
|
{
|
||||||
if (fgets(buffer, 128, pipe) != NULL)
|
if (fgets(buffer, 128, pipe))
|
||||||
{
|
{
|
||||||
int curlen = strlen(buffer);
|
int curlen = strlen(buffer);
|
||||||
|
|
||||||
|
@ -306,11 +306,11 @@ static void* onSaveInstanceState(
|
||||||
while (!android_app->stateSaved)
|
while (!android_app->stateSaved)
|
||||||
scond_wait(android_app->cond, android_app->mutex);
|
scond_wait(android_app->cond, android_app->mutex);
|
||||||
|
|
||||||
if (android_app->savedState != NULL)
|
if (android_app->savedState)
|
||||||
{
|
{
|
||||||
savedState = android_app->savedState;
|
savedState = android_app->savedState;
|
||||||
*outLen = android_app->savedStateSize;
|
*outLen = android_app->savedStateSize;
|
||||||
android_app->savedState = NULL;
|
android_app->savedState = NULL;
|
||||||
android_app->savedStateSize = 0;
|
android_app->savedStateSize = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -451,9 +451,9 @@ static struct android_app* android_app_create(ANativeActivity* activity,
|
||||||
android_app->mutex = slock_new();
|
android_app->mutex = slock_new();
|
||||||
android_app->cond = scond_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;
|
android_app->savedStateSize = savedStateSize;
|
||||||
memcpy(android_app->savedState, savedState, 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);
|
slock_lock(android_app->mutex);
|
||||||
|
|
||||||
if (android_app->savedState != NULL)
|
if (android_app->savedState)
|
||||||
{
|
{
|
||||||
free(android_app->savedState);
|
free(android_app->savedState);
|
||||||
android_app->savedState = NULL;
|
android_app->savedState = NULL;
|
||||||
android_app->savedStateSize = 0;
|
android_app->savedStateSize = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2414,7 +2414,7 @@ enum retro_language frontend_unix_get_user_language(void)
|
||||||
#else
|
#else
|
||||||
char *envvar = getenv("LANG");
|
char *envvar = getenv("LANG");
|
||||||
|
|
||||||
if (envvar != NULL)
|
if (envvar)
|
||||||
lang = rarch_get_language_from_iso(envvar);
|
lang = rarch_get_language_from_iso(envvar);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -93,7 +93,7 @@ bool dbus_screensaver_inhibit(void)
|
||||||
reply = dbus_connection_send_with_reply_and_block(dbus_connection,
|
reply = dbus_connection_send_with_reply_and_block(dbus_connection,
|
||||||
msg, 300, NULL);
|
msg, 300, NULL);
|
||||||
|
|
||||||
if (reply != NULL)
|
if (reply)
|
||||||
{
|
{
|
||||||
if (!dbus_message_get_args(reply, NULL,
|
if (!dbus_message_get_args(reply, NULL,
|
||||||
DBUS_TYPE_UINT32, &dbus_screensaver_cookie,
|
DBUS_TYPE_UINT32, &dbus_screensaver_cookie,
|
||||||
|
|
|
@ -457,7 +457,7 @@ static bool dispmanx_gfx_frame(void *data, const void *frame, unsigned width,
|
||||||
_dispvars->core_pitch = pitch;
|
_dispvars->core_pitch = pitch;
|
||||||
_dispvars->aspect_ratio = aspect;
|
_dispvars->aspect_ratio = aspect;
|
||||||
|
|
||||||
if (_dispvars->main_surface != NULL)
|
if (_dispvars->main_surface)
|
||||||
dispmanx_surface_free(_dispvars, &_dispvars->main_surface);
|
dispmanx_surface_free(_dispvars, &_dispvars->main_surface);
|
||||||
|
|
||||||
/* Internal resolution or ratio has changed, so we need
|
/* Internal resolution or ratio has changed, so we need
|
||||||
|
|
|
@ -770,7 +770,7 @@ static bool drm_gfx_frame(void *data, const void *frame, unsigned width,
|
||||||
_drmvars->core_height = height;
|
_drmvars->core_height = height;
|
||||||
_drmvars->core_pitch = pitch;
|
_drmvars->core_pitch = pitch;
|
||||||
|
|
||||||
if (_drmvars->main_surface != NULL)
|
if (_drmvars->main_surface)
|
||||||
drm_surface_free(_drmvars, &_drmvars->main_surface);
|
drm_surface_free(_drmvars, &_drmvars->main_surface);
|
||||||
|
|
||||||
/* We need to recreate the main surface and it's pages (buffers). */
|
/* We need to recreate the main surface and it's pages (buffers). */
|
||||||
|
|
|
@ -247,7 +247,7 @@ static void exynos_clean_up_pages(struct exynos_page *p, unsigned cnt)
|
||||||
|
|
||||||
for (i = 0; i < cnt; ++i)
|
for (i = 0; i < cnt; ++i)
|
||||||
{
|
{
|
||||||
if (p[i].bo != NULL)
|
if (p[i].bo)
|
||||||
{
|
{
|
||||||
if (p[i].buf_id != 0)
|
if (p[i].buf_id != 0)
|
||||||
drmModeRmFB(p[i].buf_id, p[i].bo->handle);
|
drmModeRmFB(p[i].buf_id, p[i].bo->handle);
|
||||||
|
@ -1271,7 +1271,7 @@ static void exynos_gfx_free(void *data)
|
||||||
|
|
||||||
free(pdata);
|
free(pdata);
|
||||||
|
|
||||||
if (vid->font != NULL && vid->font_driver != NULL)
|
if (vid->font && vid->font_driver)
|
||||||
vid->font_driver->free(vid->font);
|
vid->font_driver->free(vid->font);
|
||||||
|
|
||||||
free(vid);
|
free(vid);
|
||||||
|
|
|
@ -132,7 +132,7 @@ static int GLXExtensionSupported(Display *dpy, const char *extension)
|
||||||
const char *client_extensions = glXGetClientString(dpy, GLX_EXTENSIONS);
|
const char *client_extensions = glXGetClientString(dpy, GLX_EXTENSIONS);
|
||||||
const char *pos = strstr(extensionsString, extension);
|
const char *pos = strstr(extensionsString, extension);
|
||||||
|
|
||||||
if ( (pos != NULL) &&
|
if ( pos &&
|
||||||
(pos == extensionsString || pos[-1] == ' ') &&
|
(pos == extensionsString || pos[-1] == ' ') &&
|
||||||
(pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0')
|
(pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0')
|
||||||
)
|
)
|
||||||
|
@ -141,7 +141,7 @@ static int GLXExtensionSupported(Display *dpy, const char *extension)
|
||||||
pos = strstr(client_extensions, extension);
|
pos = strstr(client_extensions, extension);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(pos != NULL) &&
|
pos &&
|
||||||
(pos == extensionsString || pos[-1] == ' ') &&
|
(pos == extensionsString || pos[-1] == ' ') &&
|
||||||
(pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0')
|
(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);
|
x->g_glx_win, x->g_glx_win, x->g_ctx);
|
||||||
|
|
||||||
version = (const char*)glGetString(GL_VERSION);
|
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 */
|
/* we are done, break switch case */
|
||||||
XSetErrorHandler(old_handler);
|
XSetErrorHandler(old_handler);
|
||||||
|
|
|
@ -582,7 +582,7 @@ static bool udev_joypad_init(void *data)
|
||||||
struct udev_device *dev = udev_device_new_from_syspath(udev_joypad_fd, name);
|
struct udev_device *dev = udev_device_new_from_syspath(udev_joypad_fd, name);
|
||||||
const char *devnode = udev_device_get_devnode(dev);
|
const char *devnode = udev_device_get_devnode(dev);
|
||||||
|
|
||||||
if (devnode != NULL)
|
if (devnode)
|
||||||
udev_check_device(dev, devnode);
|
udev_check_device(dev, devnode);
|
||||||
udev_device_unref(dev);
|
udev_device_unref(dev);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ static bool wiiu_joypad_query_pad(unsigned pad)
|
||||||
{
|
{
|
||||||
return ready &&
|
return ready &&
|
||||||
pad < MAX_USERS &&
|
pad < MAX_USERS &&
|
||||||
pad_drivers[pad] != NULL &&
|
pad_drivers[pad] &&
|
||||||
pad_drivers[pad]->query_pad(pad);
|
pad_drivers[pad]->query_pad(pad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -950,7 +950,7 @@ int setting_set_with_string_representation(rarch_setting_t* setting,
|
||||||
case ST_STRING:
|
case ST_STRING:
|
||||||
case ST_STRING_OPTIONS:
|
case ST_STRING_OPTIONS:
|
||||||
case ST_ACTION:
|
case ST_ACTION:
|
||||||
if ( setting->value.target.string != NULL)
|
if (setting->value.target.string)
|
||||||
strlcpy(setting->value.target.string, value, setting->size);
|
strlcpy(setting->value.target.string, value, setting->size);
|
||||||
break;
|
break;
|
||||||
case ST_BOOL:
|
case ST_BOOL:
|
||||||
|
|
|
@ -436,7 +436,7 @@ struct netplay_room* netplay_room_get(int index)
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
while (room != NULL)
|
while (room)
|
||||||
{
|
{
|
||||||
if (cur == index)
|
if (cur == index)
|
||||||
break;
|
break;
|
||||||
|
@ -461,7 +461,7 @@ int netplay_rooms_get_count(void)
|
||||||
if (!room)
|
if (!room)
|
||||||
return count;
|
return count;
|
||||||
|
|
||||||
while(room != NULL)
|
while (room)
|
||||||
{
|
{
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ static void connmanctl_tether_toggle(bool switch_on, char* apname, char* passkey
|
||||||
RARCH_LOG("[CONNMANCTL] Tether toggle: command: \"%s\"\n",
|
RARCH_LOG("[CONNMANCTL] Tether toggle: command: \"%s\"\n",
|
||||||
command);
|
command);
|
||||||
|
|
||||||
while (fgets(output, sizeof(output), command_file) != NULL)
|
while (fgets(output, sizeof(output), command_file))
|
||||||
{
|
{
|
||||||
if (output[strlen(output)-1] == '\n')
|
if (output[strlen(output)-1] == '\n')
|
||||||
output[strlen(output)-1] = '\0';
|
output[strlen(output)-1] = '\0';
|
||||||
|
@ -176,7 +176,7 @@ static void connmanctl_scan(void)
|
||||||
MESSAGE_QUEUE_CATEGORY_INFO);
|
MESSAGE_QUEUE_CATEGORY_INFO);
|
||||||
|
|
||||||
serv_file = popen("connmanctl services", "r");
|
serv_file = popen("connmanctl services", "r");
|
||||||
while (fgets (line, 512, serv_file) != NULL)
|
while (fgets(line, 512, serv_file))
|
||||||
{
|
{
|
||||||
size_t len = strlen(line);
|
size_t len = strlen(line);
|
||||||
if (len > 0 && line[len-1] == '\n')
|
if (len > 0 && line[len-1] == '\n')
|
||||||
|
@ -236,7 +236,7 @@ static bool connmanctl_ssid_is_online(unsigned i)
|
||||||
|
|
||||||
command_file = popen(command, "r");
|
command_file = popen(command, "r");
|
||||||
|
|
||||||
while (fgets (ln, 512, command_file) != NULL)
|
while (fgets(ln, 512, command_file))
|
||||||
{
|
{
|
||||||
connman_cache[i] = true;
|
connman_cache[i] = true;
|
||||||
return true;
|
return true;
|
||||||
|
@ -333,7 +333,7 @@ static bool connmanctl_connect_ssid(unsigned idx, const char* passphrase)
|
||||||
|
|
||||||
command_file = popen(command, "r");
|
command_file = popen(command, "r");
|
||||||
|
|
||||||
while (fgets (ln, sizeof(ln), command_file) != NULL)
|
while (fgets(ln, sizeof(ln), command_file))
|
||||||
{
|
{
|
||||||
#ifdef HAVE_GFX_WIDGETS
|
#ifdef HAVE_GFX_WIDGETS
|
||||||
if (!gfx_widgets_ready())
|
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",
|
RARCH_LOG("[CONNMANCTL] Testing configured services for activity: command: \"%s\"\n",
|
||||||
command);
|
command);
|
||||||
|
|
||||||
while (fgets(temp, buffersize, command_file) != NULL)
|
while (fgets(temp, buffersize, command_file))
|
||||||
{
|
{
|
||||||
if (strlen(temp) > 0)
|
if (strlen(temp) > 0)
|
||||||
if (temp[strlen(temp)-1] == '\n')
|
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",
|
RARCH_LOG("[CONNMANCTL] Tether start stop: parsing command: \"%s\"\n",
|
||||||
command);
|
command);
|
||||||
|
|
||||||
while (fgets(ln, sizeof(ln), command_file) != NULL)
|
while (fgets(ln, sizeof(ln), command_file))
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
if (strlen(ln) > 1)
|
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",
|
RARCH_LOG("[CONNMANCTL] Tether start stop: disconnecting from service \"%s\", command: \"%s\"\n",
|
||||||
service, command);
|
service, command);
|
||||||
|
|
||||||
while (fgets(ln, sizeof(ln), command_file) != NULL)
|
while (fgets(ln, sizeof(ln), command_file))
|
||||||
{
|
{
|
||||||
if (ln[strlen(ln)-1] == '\n')
|
if (ln[strlen(ln)-1] == '\n')
|
||||||
ln[strlen(ln)-1] = '\0';
|
ln[strlen(ln)-1] = '\0';
|
||||||
|
|
Loading…
Reference in New Issue