os: remove superfluous condition on init

remove superfluous #include math.h
This commit is contained in:
Andrew Kelley 2015-09-17 13:55:47 -07:00
parent f52080a1fd
commit dbed33abd2
4 changed files with 3 additions and 11 deletions

View file

@ -9,7 +9,6 @@
#include "soundio.hpp" #include "soundio.hpp"
#include <sys/inotify.h> #include <sys/inotify.h>
#include <math.h>
static snd_pcm_stream_t stream_types[] = {SND_PCM_STREAM_PLAYBACK, SND_PCM_STREAM_CAPTURE}; static snd_pcm_stream_t stream_types[] = {SND_PCM_STREAM_PLAYBACK, SND_PCM_STREAM_CAPTURE};

View file

@ -10,7 +10,6 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <math.h>
static void playback_thread_run(void *arg) { static void playback_thread_run(void *arg) {
SoundIoOutStreamPrivate *os = (SoundIoOutStreamPrivate *)arg; SoundIoOutStreamPrivate *os = (SoundIoOutStreamPrivate *)arg;

View file

@ -8,14 +8,12 @@
#include "os.h" #include "os.h"
#include "soundio_private.h" #include "soundio_private.h"
#include "util.hpp" #include "util.hpp"
#include "atomics.hpp"
#include <stdlib.h> #include <stdlib.h>
#include <time.h> #include <time.h>
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <math.h>
#if defined(_WIN32) #if defined(_WIN32)
#define SOUNDIO_OS_WINDOWS #define SOUNDIO_OS_WINDOWS
@ -125,7 +123,7 @@ static INIT_ONCE win32_init_once = INIT_ONCE_STATIC_INIT;
static double win32_time_resolution; static double win32_time_resolution;
static SYSTEM_INFO win32_system_info; static SYSTEM_INFO win32_system_info;
#else #else
static atomic_bool initialized = ATOMIC_VAR_INIT(false); static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
#if defined(__MACH__) #if defined(__MACH__)
static clock_serv_t cclock; static clock_serv_t cclock;
@ -586,15 +584,12 @@ int soundio_os_init(void) {
if (!InitOnceComplete(&win32_init_once, INIT_ONCE_ASYNC, nullptr)) if (!InitOnceComplete(&win32_init_once, INIT_ONCE_ASYNC, nullptr))
return SoundIoErrorSystemResources; return SoundIoErrorSystemResources;
#else #else
if (initialized.load())
return 0;
assert_no_err(pthread_mutex_lock(&init_mutex)); assert_no_err(pthread_mutex_lock(&init_mutex));
if (initialized.load()) { if (initialized) {
assert_no_err(pthread_mutex_unlock(&init_mutex)); assert_no_err(pthread_mutex_unlock(&init_mutex));
return 0; return 0;
} }
initialized.store(true); initialized = true;
if ((err = internal_init())) if ((err = internal_init()))
return err; return err;
assert_no_err(pthread_mutex_unlock(&init_mutex)); assert_no_err(pthread_mutex_unlock(&init_mutex));

View file

@ -9,7 +9,6 @@
#include "soundio.hpp" #include "soundio.hpp"
#include <string.h> #include <string.h>
#include <math.h>
#include <stdio.h> #include <stdio.h>