diff --git a/libretro-common/features/features_cpu.c b/libretro-common/features/features_cpu.c index 78e6f82d50..ddc4804692 100644 --- a/libretro-common/features/features_cpu.c +++ b/libretro-common/features/features_cpu.c @@ -348,12 +348,12 @@ static unsigned char check_arm_cpu_feature(const char* feature) if (!fp) return 0; - while (filestream_gets(fp, line, sizeof(line)) != NULL) + while (filestream_gets(fp, line, sizeof(line))) { if (strncmp(line, "Features\t: ", 11)) continue; - if (strstr(line + 11, feature) != NULL) + if (strstr(line + 11, feature)) status = 1; break; diff --git a/libretro-common/file/archive_file_7z.c b/libretro-common/file/archive_file_7z.c index 86e03b7d11..b8ab5abd77 100644 --- a/libretro-common/file/archive_file_7z.c +++ b/libretro-common/file/archive_file_7z.c @@ -256,7 +256,7 @@ static int sevenzip_file_read( outsize = outSizeProcessed; - if (optional_outfile != NULL) + if (optional_outfile) { const void *ptr = (const void*)(output + offset); diff --git a/libretro-common/file/config_file.c b/libretro-common/file/config_file.c index a16e2148b1..d9856c2861 100644 --- a/libretro-common/file/config_file.c +++ b/libretro-common/file/config_file.c @@ -450,7 +450,7 @@ static config_file_t *config_file_new_internal( conf->tail = list; - if (cb != NULL && list->key != NULL && list->value != NULL) + if (cb && list->key && list->value) cb->config_file_new_entry_cb(list->key, list->value) ; } diff --git a/libretro-common/file/retro_dirent.c b/libretro-common/file/retro_dirent.c index 752cbdad01..f79b37ce90 100644 --- a/libretro-common/file/retro_dirent.c +++ b/libretro-common/file/retro_dirent.c @@ -61,7 +61,7 @@ void dirent_vfs_init(const struct retro_vfs_interface_info* vfs_info) struct RDIR *retro_opendir_include_hidden(const char *name, bool include_hidden) { - if (dirent_opendir_cb != NULL) + if (dirent_opendir_cb) return (struct RDIR *)dirent_opendir_cb(name, include_hidden); return (struct RDIR *)retro_vfs_opendir_impl(name, include_hidden); } @@ -79,14 +79,14 @@ bool retro_dirent_error(struct RDIR *rdir) int retro_readdir(struct RDIR *rdir) { - if (dirent_readdir_cb != NULL) + if (dirent_readdir_cb) return dirent_readdir_cb((struct retro_vfs_dir_handle *)rdir); return retro_vfs_readdir_impl((struct retro_vfs_dir_handle *)rdir); } const char *retro_dirent_get_name(struct RDIR *rdir) { - if (dirent_dirent_get_name_cb != NULL) + if (dirent_dirent_get_name_cb) return dirent_dirent_get_name_cb((struct retro_vfs_dir_handle *)rdir); return retro_vfs_dirent_get_name_impl((struct retro_vfs_dir_handle *)rdir); } @@ -104,14 +104,14 @@ const char *retro_dirent_get_name(struct RDIR *rdir) */ bool retro_dirent_is_dir(struct RDIR *rdir, const char *unused) { - if (dirent_dirent_is_dir_cb != NULL) + if (dirent_dirent_is_dir_cb) return dirent_dirent_is_dir_cb((struct retro_vfs_dir_handle *)rdir); return retro_vfs_dirent_is_dir_impl((struct retro_vfs_dir_handle *)rdir); } void retro_closedir(struct RDIR *rdir) { - if (dirent_closedir_cb != NULL) + if (dirent_closedir_cb) dirent_closedir_cb((struct retro_vfs_dir_handle *)rdir); else retro_vfs_closedir_impl((struct retro_vfs_dir_handle *)rdir); diff --git a/libretro-common/formats/cdfs/cdfs.c b/libretro-common/formats/cdfs/cdfs.c index 5f77af6e9e..9f468afb29 100644 --- a/libretro-common/formats/cdfs/cdfs.c +++ b/libretro-common/formats/cdfs/cdfs.c @@ -156,19 +156,15 @@ int cdfs_open_file(cdfs_file_t* file, cdfs_track_t* track, const char* path) file->track = track; file->current_sector = -1; - if (path != NULL) - { + if (path) file->first_sector = cdfs_find_file(file, path); - } else if (file->track->stream_sector_size) { file->first_sector = 0; file->size = (intfstream_get_size(file->track->stream) / file->track->stream_sector_size) * 2048; } else - { file->first_sector = -1; - } return (file->first_sector >= 0); } diff --git a/libretro-common/queues/task_queue.c b/libretro-common/queues/task_queue.c index 7e0f9e8d54..ddee6f0625 100644 --- a/libretro-common/queues/task_queue.c +++ b/libretro-common/queues/task_queue.c @@ -135,7 +135,7 @@ static retro_task_t *task_queue_get(task_queue_t *queue) static void retro_task_internal_gather(void) { retro_task_t *task = NULL; - while ((task = task_queue_get(&tasks_finished)) != NULL) + while ((task = task_queue_get(&tasks_finished))) { task_queue_push_progress(task); @@ -172,7 +172,7 @@ static void retro_task_regular_gather(void) retro_task_t *queue = NULL; retro_task_t *next = NULL; - while ((task = task_queue_get(&tasks_running)) != NULL) + while ((task = task_queue_get(&tasks_running))) { task->next = queue; queue = task; @@ -387,7 +387,7 @@ static void retro_task_threaded_wait(retro_task_condition_fn_t cond, void* data) retro_task_threaded_gather(); slock_lock(running_lock); - wait = (tasks_running.front != NULL) && + wait = (tasks_running.front) && (!cond || cond(data)); slock_unlock(running_lock); } while (wait); diff --git a/libretro-common/streams/file_stream.c b/libretro-common/streams/file_stream.c index e3e4590752..a81563bcfe 100644 --- a/libretro-common/streams/file_stream.c +++ b/libretro-common/streams/file_stream.c @@ -119,7 +119,7 @@ int64_t filestream_get_size(RFILE *stream) { int64_t output; - if (filestream_size_cb != NULL) + if (filestream_size_cb) output = filestream_size_cb(stream->hfile); else output = retro_vfs_file_size_impl((libretro_vfs_implementation_file*)stream->hfile); @@ -134,7 +134,7 @@ int64_t filestream_truncate(RFILE *stream, int64_t length) { int64_t output; - if (filestream_truncate_cb != NULL) + if (filestream_truncate_cb) output = filestream_truncate_cb(stream->hfile, length); else output = retro_vfs_file_truncate_impl((libretro_vfs_implementation_file*)stream->hfile, length); @@ -159,7 +159,7 @@ RFILE* filestream_open(const char *path, unsigned mode, unsigned hints) struct retro_vfs_file_handle *fp = NULL; RFILE* output = NULL; - if (filestream_open_cb != NULL) + if (filestream_open_cb) fp = (struct retro_vfs_file_handle*) filestream_open_cb(path, mode, hints); else @@ -309,7 +309,7 @@ int64_t filestream_seek(RFILE *stream, int64_t offset, int seek_position) { int64_t output; - if (filestream_seek_cb != NULL) + if (filestream_seek_cb) output = filestream_seek_cb(stream->hfile, offset, seek_position); else output = retro_vfs_file_seek_impl((libretro_vfs_implementation_file*)stream->hfile, offset, seek_position); @@ -330,7 +330,7 @@ int64_t filestream_tell(RFILE *stream) { int64_t output; - if (filestream_size_cb != NULL) + if (filestream_size_cb) output = filestream_tell_cb(stream->hfile); else output = retro_vfs_file_tell_impl((libretro_vfs_implementation_file*)stream->hfile); @@ -354,7 +354,7 @@ int64_t filestream_read(RFILE *stream, void *s, int64_t len) { int64_t output; - if (filestream_read_cb != NULL) + if (filestream_read_cb) output = filestream_read_cb(stream->hfile, s, len); else output = retro_vfs_file_read_impl( @@ -372,7 +372,7 @@ int filestream_flush(RFILE *stream) { int output; - if (filestream_flush_cb != NULL) + if (filestream_flush_cb) output = filestream_flush_cb(stream->hfile); else output = retro_vfs_file_flush_impl((libretro_vfs_implementation_file*)stream->hfile); @@ -385,7 +385,7 @@ int filestream_flush(RFILE *stream) int filestream_delete(const char *path) { - if (filestream_remove_cb != NULL) + if (filestream_remove_cb) return filestream_remove_cb(path); return retro_vfs_file_remove_impl(path); @@ -393,7 +393,7 @@ int filestream_delete(const char *path) int filestream_rename(const char *old_path, const char *new_path) { - if (filestream_rename_cb != NULL) + if (filestream_rename_cb) return filestream_rename_cb(old_path, new_path); return retro_vfs_file_rename_impl(old_path, new_path); @@ -401,7 +401,7 @@ int filestream_rename(const char *old_path, const char *new_path) const char* filestream_get_path(RFILE *stream) { - if (filestream_get_path_cb != NULL) + if (filestream_get_path_cb) return filestream_get_path_cb(stream->hfile); return retro_vfs_file_get_path_impl((libretro_vfs_implementation_file*)stream->hfile); @@ -411,7 +411,7 @@ int64_t filestream_write(RFILE *stream, const void *s, int64_t len) { int64_t output; - if (filestream_write_cb != NULL) + if (filestream_write_cb) output = filestream_write_cb(stream->hfile, s, len); else output = retro_vfs_file_write_impl((libretro_vfs_implementation_file*)stream->hfile, s, len); @@ -465,7 +465,7 @@ int filestream_close(RFILE *stream) int output; struct retro_vfs_file_handle* fp = stream->hfile; - if (filestream_close_cb != NULL) + if (filestream_close_cb) output = filestream_close_cb(fp); else output = retro_vfs_file_close_impl((libretro_vfs_implementation_file*)fp); diff --git a/libretro-common/string/stdstring.c b/libretro-common/string/stdstring.c index e2afef14d5..a4bf172d7d 100644 --- a/libretro-common/string/stdstring.c +++ b/libretro-common/string/stdstring.c @@ -328,7 +328,7 @@ void string_replace_all_chars(char *str, char find, char replace) if (string_is_empty(str)) return; - while((str_ptr = strchr(str_ptr, find)) != NULL) + while ((str_ptr = strchr(str_ptr, find))) *str_ptr++ = replace; } diff --git a/network/netplay/netplay_frontend.c b/network/netplay/netplay_frontend.c index 35ff488034..a4cc4cf4bd 100644 --- a/network/netplay/netplay_frontend.c +++ b/network/netplay/netplay_frontend.c @@ -643,8 +643,6 @@ static int16_t netplay_input_state(netplay_t *netplay, static void netplay_announce_cb(retro_task_t *task, void *task_data, void *user_data, const char *error) { - RARCH_LOG("[netplay] announcing netplay game... \n"); - if (task_data) { unsigned i, ip_len, port_len; @@ -762,8 +760,6 @@ static void netplay_announce_cb(retro_task_t *task, if (mitm_ip && mitm_port) { - RARCH_LOG("[netplay] joining relay server: %s:%s\n", mitm_ip, mitm_port); - ip_len = (unsigned)strlen(mitm_ip); port_len = (unsigned)strlen(mitm_port); @@ -877,9 +873,6 @@ static void netplay_announce(void) *settings->paths.netplay_spectate_password ? 1 : 0, settings->bools.netplay_use_mitm_server, PACKAGE_VERSION, frontend_architecture, subsystemname); -#if 0 - RARCH_LOG("[netplay] announcement URL: %s\n", buf); -#endif task_push_http_post_transfer(url, buf, true, NULL, netplay_announce_cb, NULL); if (username)