don't include os_compat.h

When there are standardized headers, use these instead of the bloated
os_compat.h.
This commit is contained in:
Max Kellermann 2008-10-08 10:49:29 +02:00
parent ca68b1c80a
commit 71351160b1
62 changed files with 143 additions and 38 deletions

View File

@ -19,7 +19,7 @@
#ifndef AUDIO_H #ifndef AUDIO_H
#define AUDIO_H #define AUDIO_H
#include "os_compat.h" #include <stdio.h>
#define AUDIO_AO_DRIVER_DEFAULT "default" #define AUDIO_AO_DRIVER_DEFAULT "default"

View File

@ -19,7 +19,7 @@
#ifndef AUDIO_OUTPUT_H #ifndef AUDIO_OUTPUT_H
#define AUDIO_OUTPUT_H #define AUDIO_OUTPUT_H
#include "os_compat.h" #include <stdio.h>
void printAllOutputPluginTypes(FILE * fp); void printAllOutputPluginTypes(FILE * fp);

View File

@ -24,6 +24,10 @@
#include "../utils.h" #include "../utils.h"
#include "../timer.h" #include "../timer.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#define FIFO_BUFFER_SIZE 65536 /* pipe capacity on Linux >= 2.6.11 */ #define FIFO_BUFFER_SIZE 65536 /* pipe capacity on Linux >= 2.6.11 */
typedef struct _FifoData { typedef struct _FifoData {

View File

@ -22,6 +22,8 @@
#include "../utils.h" #include "../utils.h"
#include "../log.h" #include "../log.h"
#include <assert.h>
#include <jack/jack.h> #include <jack/jack.h>
#include <jack/types.h> #include <jack/types.h>
#include <jack/ringbuffer.h> #include <jack/ringbuffer.h>

View File

@ -26,6 +26,10 @@
#include "../utils.h" #include "../utils.h"
#include "../log.h" #include "../log.h"
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#if defined(__OpenBSD__) || defined(__NetBSD__) #if defined(__OpenBSD__) || defined(__NetBSD__)
# include <soundcard.h> # include <soundcard.h>
#else /* !(defined(__OpenBSD__) || defined(__NetBSD__) */ #else /* !(defined(__OpenBSD__) || defined(__NetBSD__) */

View File

@ -22,6 +22,8 @@
#include "../utils.h" #include "../utils.h"
#include <assert.h>
#define CONN_ATTEMPT_INTERVAL 60 #define CONN_ATTEMPT_INTERVAL 60
#define DEFAULT_CONN_TIMEOUT 2 #define DEFAULT_CONN_TIMEOUT 2

View File

@ -25,12 +25,18 @@
#include "sllist.h" #include "sllist.h"
#include "utils.h" #include "utils.h"
#include "ioops.h" #include "ioops.h"
#include "os_compat.h"
#include "main_notify.h" #include "main_notify.h"
#include "dlist.h" #include "dlist.h"
#include "../config.h" #include "../config.h"
#include <assert.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <string.h>
#define GREETING "OK MPD " PROTOCOL_VERSION "\n" #define GREETING "OK MPD " PROTOCOL_VERSION "\n"
#define CLIENT_MAX_BUFFER_LENGTH (40960) #define CLIENT_MAX_BUFFER_LENGTH (40960)

View File

@ -19,9 +19,12 @@
#ifndef INTERFACE_H #ifndef INTERFACE_H
#define INTERFACE_H #define INTERFACE_H
#include "os_compat.h"
#include "gcc.h" #include "gcc.h"
#include <stddef.h>
#include <stdarg.h>
#include <sys/socket.h>
struct client; struct client;
void client_manager_init(void); void client_manager_init(void);

View File

@ -20,7 +20,6 @@
#define COMMAND_H #define COMMAND_H
#include "gcc.h" #include "gcc.h"
#include "os_compat.h"
#include "sllist.h" #include "sllist.h"
#define COMMAND_RETURN_KILL 10 #define COMMAND_RETURN_KILL 10

View File

@ -21,6 +21,9 @@
#include "utils.h" #include "utils.h"
#include "log.h" #include "log.h"
#include <sys/time.h>
#include <string.h>
void cond_init(struct condition *cond) void cond_init(struct condition *cond)
{ {
xpthread_mutex_init(&cond->mutex, NULL); xpthread_mutex_init(&cond->mutex, NULL);

View File

@ -20,7 +20,7 @@
#ifndef CONDITION_H #ifndef CONDITION_H
#define CONDITION_H #define CONDITION_H
#include "os_compat.h" #include <pthread.h>
struct condition { struct condition {
pthread_mutex_t mutex; pthread_mutex_t mutex;

View File

@ -21,6 +21,9 @@
#include "audio.h" #include "audio.h"
#include "pcm_utils.h" #include "pcm_utils.h"
#include <assert.h>
#include <string.h>
unsigned cross_fade_calc(float duration, float total_time, unsigned cross_fade_calc(float duration, float total_time,
const struct audio_format *af, const struct audio_format *af,
unsigned max_chunks) unsigned max_chunks)

View File

@ -29,6 +29,8 @@
#include "outputBuffer.h" #include "outputBuffer.h"
#include "gcc.h" #include "gcc.h"
#include <assert.h>
void decoder_plugin_register(struct decoder_plugin *plugin) void decoder_plugin_register(struct decoder_plugin *plugin)
{ {
decoder_plugin_load(plugin); decoder_plugin_load(plugin);

View File

@ -18,6 +18,8 @@
#include "decoder_control.h" #include "decoder_control.h"
#include <assert.h>
struct decoder_control dc; struct decoder_control dc;
void dc_init(void) void dc_init(void)

View File

@ -19,7 +19,7 @@
#ifndef INPUT_PLUGIN_H #ifndef INPUT_PLUGIN_H
#define INPUT_PLUGIN_H #define INPUT_PLUGIN_H
#include "os_compat.h" #include <stdio.h>
struct decoder_plugin; struct decoder_plugin;

View File

@ -23,6 +23,7 @@
#include "list.h" #include "list.h"
#include <stdbool.h> #include <stdbool.h>
#include <sys/stat.h>
struct client; struct client;

View File

@ -1,8 +1,9 @@
#include "dirvec.h" #include "dirvec.h"
#include "directory.h" #include "directory.h"
#include "os_compat.h"
#include "utils.h" #include "utils.h"
#include <string.h>
static size_t dv_size(struct dirvec *dv) static size_t dv_size(struct dirvec *dv)
{ {
return dv->nr * sizeof(struct directory *); return dv->nr * sizeof(struct directory *);

View File

@ -25,6 +25,7 @@
#include "../utils.h" #include "../utils.h"
#include "../log.h" #include "../log.h"
#include <assert.h>
#include <faad.h> #include <faad.h>
/* all code here is either based on or copied from FAAD2's frontend code */ /* all code here is either based on or copied from FAAD2's frontend code */

View File

@ -24,6 +24,7 @@
#include "../log.h" #include "../log.h"
#include <sys/stat.h>
#include <audiofile.h> #include <audiofile.h>
/* pick 1020 since its devisible for 8,16,24, and 32-bit audio */ /* pick 1020 since its devisible for 8,16,24, and 32-bit audio */

View File

@ -23,6 +23,8 @@
#include "../utils.h" #include "../utils.h"
#include "../log.h" #include "../log.h"
#include <assert.h>
/* this code was based on flac123, from flac-tools */ /* this code was based on flac123, from flac-tools */
static flac_read_status flacRead(mpd_unused const flac_decoder * flacDec, static flac_read_status flacRead(mpd_unused const flac_decoder * flacDec,

View File

@ -25,6 +25,7 @@
#include "../mp4ff/mp4ff.h" #include "../mp4ff/mp4ff.h"
#include <limits.h>
#include <faad.h> #include <faad.h>
/* all code here is either based on or copied from FAAD2's frontend code */ /* all code here is either based on or copied from FAAD2's frontend code */

View File

@ -21,7 +21,7 @@
#include "inputStream_file.h" #include "inputStream_file.h"
#include "inputStream_http.h" #include "inputStream_http.h"
#include "os_compat.h" #include <stdlib.h>
void initInputStream(void) void initInputStream(void)
{ {

View File

@ -19,7 +19,7 @@
#ifndef INPUT_STREAM_H #ifndef INPUT_STREAM_H
#define INPUT_STREAM_H #define INPUT_STREAM_H
#include "os_compat.h" #include <stddef.h>
typedef struct _InputStream InputStream; typedef struct _InputStream InputStream;

View File

@ -20,9 +20,10 @@
#ifndef INPUT_STREAM_HTTP_AUTH_H #ifndef INPUT_STREAM_HTTP_AUTH_H
#define INPUT_STREAM_HTTP_AUTH_H #define INPUT_STREAM_HTTP_AUTH_H
#include "os_compat.h"
#include "utils.h" #include "utils.h"
#include <string.h>
/* base64 code taken from xmms */ /* base64 code taken from xmms */
#define BASE64_LENGTH(len) (4 * (((len) + 2) / 3)) #define BASE64_LENGTH(len) (4 * (((len) + 2) / 3))

View File

@ -18,6 +18,9 @@
#include "ioops.h" #include "ioops.h"
#include <assert.h>
#include <stddef.h>
/* Eventually the listener protocol will use this, too */ /* Eventually the listener protocol will use this, too */
/* /*

View File

@ -19,8 +19,7 @@
#ifndef IOOPS_H #ifndef IOOPS_H
#define IOOPS_H #define IOOPS_H
#include "../config.h" #include <sys/select.h>
#include "os_compat.h"
struct ioOps { struct ioOps {
struct ioOps *prev, *next; struct ioOps *prev, *next;

View File

@ -19,6 +19,9 @@
#include "list.h" #include "list.h"
#include "utils.h" #include "utils.h"
#include <assert.h>
#include <string.h>
static void makeListNodesArray(List * list) static void makeListNodesArray(List * list)
{ {
ListNode *node = list->firstNode; ListNode *node = list->firstNode;

View File

@ -19,8 +19,6 @@
#ifndef LIST_H #ifndef LIST_H
#define LIST_H #define LIST_H
#include "os_compat.h"
/* used to make a list where free() will be used to free data in list */ /* used to make a list where free() will be used to free data in list */
#define DEFAULT_FREE_DATA_FUNC free #define DEFAULT_FREE_DATA_FUNC free

View File

@ -19,7 +19,7 @@
#ifndef LISTEN_H #ifndef LISTEN_H
#define LISTEN_H #define LISTEN_H
#include "os_compat.h" #include <sys/select.h>
extern int boundPort; extern int boundPort;

View File

@ -20,7 +20,13 @@
#include "conf.h" #include "conf.h"
#include "utils.h" #include "utils.h"
#include "os_compat.h"
#include <assert.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <stdarg.h>
#include <fcntl.h>
#define LOG_DATE_BUF_SIZE 16 #define LOG_DATE_BUF_SIZE 16
#define LOG_DATE_LEN (LOG_DATE_BUF_SIZE - 1) #define LOG_DATE_LEN (LOG_DATE_BUF_SIZE - 1)

View File

@ -21,6 +21,9 @@
#include "decoder_list.h" #include "decoder_list.h"
#include <sys/time.h>
struct stat;
struct client; struct client;
int lsPlaylists(struct client *client, const char *utf8path); int lsPlaylists(struct client *client, const char *utf8path);

View File

@ -25,6 +25,9 @@
#include "gcc.h" #include "gcc.h"
#include "log.h" #include "log.h"
#include <assert.h>
#include <string.h>
static struct ioOps main_notify_IO; static struct ioOps main_notify_IO;
static int main_pipe[2]; static int main_pipe[2];
pthread_t main_task; pthread_t main_task;

View File

@ -19,7 +19,7 @@
#ifndef NOTIFY_H #ifndef NOTIFY_H
#define NOTIFY_H #define NOTIFY_H
#include "os_compat.h" #include <pthread.h>
struct notify { struct notify {
pthread_mutex_t mutex; pthread_mutex_t mutex;

View File

@ -20,6 +20,9 @@
#include "notify.h" #include "notify.h"
#include "utils.h" #include "utils.h"
#include <assert.h>
#include <string.h>
struct output_buffer ob; struct output_buffer ob;
void void

View File

@ -19,6 +19,8 @@
#include "output_api.h" #include "output_api.h"
#include "output_internal.h" #include "output_internal.h"
#include <assert.h>
const char *audio_output_get_name(const struct audio_output *ao) const char *audio_output_get_name(const struct audio_output *ao)
{ {
return ao->name; return ao->name;

View File

@ -25,7 +25,6 @@
#include "tag.h" #include "tag.h"
#include "conf.h" #include "conf.h"
#include "log.h" #include "log.h"
#include "os_compat.h"
#include <stdbool.h> #include <stdbool.h>

View File

@ -23,6 +23,8 @@
#include "pcm_utils.h" #include "pcm_utils.h"
#include <pthread.h> #include <pthread.h>
#include <assert.h>
#include <stdlib.h>
struct notify audio_output_client_notify = NOTIFY_INITIALIZER; struct notify audio_output_client_notify = NOTIFY_INITIALIZER;

View File

@ -20,7 +20,8 @@
#define OUTPUT_CONTROL_H #define OUTPUT_CONTROL_H
#include "conf.h" #include "conf.h"
#include "os_compat.h"
#include <stddef.h>
struct audio_output; struct audio_output;
struct audio_output_plugin; struct audio_output_plugin;

View File

@ -21,6 +21,8 @@
#include "output_internal.h" #include "output_internal.h"
#include "utils.h" #include "utils.h"
#include <assert.h>
static void ao_command_finished(struct audio_output *ao) static void ao_command_finished(struct audio_output *ao)
{ {
assert(ao->command != AO_COMMAND_NONE); assert(ao->command != AO_COMMAND_NONE);

View File

@ -21,7 +21,10 @@
#include "utils.h" #include "utils.h"
#include "conf.h" #include "conf.h"
#include "audio_format.h" #include "audio_format.h"
#include "os_compat.h"
#include <assert.h>
#include <string.h>
#include <math.h>
static inline int static inline int
pcm_dither(void) pcm_dither(void)

View File

@ -20,7 +20,8 @@
#define PLAYER_H #define PLAYER_H
#include "notify.h" #include "notify.h"
#include "os_compat.h"
#include <stdint.h>
enum player_state { enum player_state {
PLAYER_STATE_STOP = 0, PLAYER_STATE_STOP = 0,

View File

@ -25,6 +25,8 @@
#include "ringbuf.h" #include "ringbuf.h"
#include "utils.h" #include "utils.h"
#include <string.h>
#define advance_ptr(ptr,cnt,mask) ptr = (ptr + cnt) & mask #define advance_ptr(ptr,cnt,mask) ptr = (ptr + cnt) & mask
/* /*

View File

@ -22,7 +22,8 @@
#ifndef RINGBUF_H #ifndef RINGBUF_H
#define RINGBUF_H #define RINGBUF_H
#include "os_compat.h" #include <stddef.h>
#include <sys/uio.h>
/** @file ringbuf.h /** @file ringbuf.h
* *

View File

@ -25,6 +25,10 @@
#include "signal_check.h" #include "signal_check.h"
#include "log.h" #include "log.h"
#include <sys/signal.h>
#include <sys/wait.h>
#include <errno.h>
int handlePendingSignals(void) int handlePendingSignals(void)
{ {
if (signal_is_pending(SIGINT) || signal_is_pending(SIGTERM)) { if (signal_is_pending(SIGINT) || signal_is_pending(SIGTERM)) {

View File

@ -21,6 +21,8 @@
#include "sllist.h" #include "sllist.h"
#include "utils.h" #include "utils.h"
#include <string.h>
static void init_strnode(struct strnode *x, char *s) static void init_strnode(struct strnode *x, char *s)
{ {
x->data = s; x->data = s;

View File

@ -21,7 +21,7 @@
#ifndef SLLIST_H #ifndef SLLIST_H
#define SLLIST_H #define SLLIST_H
#include "os_compat.h" #include <stddef.h>
/* just free the entire structure if it's free-able, the 'data' member /* just free the entire structure if it's free-able, the 'data' member
* should _NEVER_ be explicitly freed * should _NEVER_ be explicitly freed

View File

@ -26,8 +26,6 @@
#include "decoder_list.h" #include "decoder_list.h"
#include "decoder_api.h" #include "decoder_api.h"
#include "os_compat.h"
struct song * struct song *
song_alloc(const char *url, struct directory *parent) song_alloc(const char *url, struct directory *parent)
{ {

View File

@ -19,7 +19,7 @@
#ifndef SONG_H #ifndef SONG_H
#define SONG_H #define SONG_H
#include "os_compat.h" #include <sys/time.h>
#define SONG_BEGIN "songList begin" #define SONG_BEGIN "songList begin"
#define SONG_END "songList end" #define SONG_END "songList end"
@ -31,7 +31,7 @@ struct song {
struct tag *tag; struct tag *tag;
struct directory *parentDir; struct directory *parentDir;
time_t mtime; time_t mtime;
char url[sizeof(size_t)]; char url[sizeof(int)];
}; };
struct song * struct song *

View File

@ -2,6 +2,9 @@
#include "song.h" #include "song.h"
#include "utils.h" #include "utils.h"
#include <assert.h>
#include <string.h>
static pthread_mutex_t nr_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t nr_lock = PTHREAD_MUTEX_INITIALIZER;
/* Only used for sorting/searchin a songvec, not general purpose compares */ /* Only used for sorting/searchin a songvec, not general purpose compares */

View File

@ -1,7 +1,7 @@
#ifndef SONGVEC_H #ifndef SONGVEC_H
#define SONGVEC_H #define SONGVEC_H
#include "os_compat.h" #include <stddef.h>
struct songvec { struct songvec {
struct song **base; struct song **base;

View File

@ -25,7 +25,9 @@
#include "playlist.h" #include "playlist.h"
#include "utils.h" #include "utils.h"
#include "volume.h" #include "volume.h"
#include "os_compat.h"
#include <string.h>
#include <sys/stat.h>
static struct _sf_cb { static struct _sf_cb {
void (*reader)(FILE *); void (*reader)(FILE *);

View File

@ -25,6 +25,8 @@
#include "conf.h" #include "conf.h"
#include "song.h" #include "song.h"
#include <assert.h>
/** /**
* Maximum number of items managed in the bulk list; if it is * Maximum number of items managed in the bulk list; if it is
* exceeded, we switch back to "normal" reallocation. * exceeded, we switch back to "normal" reallocation.

View File

@ -19,9 +19,12 @@
#ifndef TAG_H #ifndef TAG_H
#define TAG_H #define TAG_H
#include "os_compat.h"
#include "gcc.h" #include "gcc.h"
#include <stdint.h>
#include <stddef.h>
#include <string.h>
enum tag_type { enum tag_type {
TAG_ITEM_ARTIST, TAG_ITEM_ARTIST,
TAG_ITEM_ALBUM, TAG_ITEM_ALBUM,

View File

@ -19,6 +19,8 @@
#include "tag_pool.h" #include "tag_pool.h"
#include "utils.h" #include "utils.h"
#include <assert.h>
pthread_mutex_t tag_pool_lock = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t tag_pool_lock = PTHREAD_MUTEX_INITIALIZER;
#define NUM_SLOTS 4096 #define NUM_SLOTS 4096

View File

@ -20,7 +20,8 @@
#define TAG_POOL_H #define TAG_POOL_H
#include "tag.h" #include "tag.h"
#include "os_compat.h"
#include <pthread.h>
extern pthread_mutex_t tag_pool_lock; extern pthread_mutex_t tag_pool_lock;

View File

@ -19,7 +19,7 @@
#ifndef TAG_SAVE_H #ifndef TAG_SAVE_H
#define TAG_SAVE_H #define TAG_SAVE_H
#include "os_compat.h" #include <stdio.h>
struct tag; struct tag;

View File

@ -19,7 +19,10 @@
#include "timer.h" #include "timer.h"
#include "utils.h" #include "utils.h"
#include "audio_format.h" #include "audio_format.h"
#include "os_compat.h"
#include <assert.h>
#include <limits.h>
#include <sys/time.h>
static uint64_t now(void) static uint64_t now(void)
{ {

View File

@ -19,7 +19,7 @@
#ifndef MPD_TIMER_H #ifndef MPD_TIMER_H
#define MPD_TIMER_H #define MPD_TIMER_H
#include "os_compat.h" #include <stdint.h>
struct audio_format; struct audio_format;

View File

@ -19,7 +19,7 @@
#ifndef UTF_8_H #ifndef UTF_8_H
#define UTF_8_H #define UTF_8_H
#include <os_compat.h> #include <stddef.h>
char *latin1StrToUtf8Dup(const char *latin1); char *latin1StrToUtf8Dup(const char *latin1);

View File

@ -22,6 +22,17 @@
#include "../config.h" #include "../config.h"
#include <assert.h>
#include <string.h>
#include <ctype.h>
#include <sys/types.h>
#include <pwd.h>
#include <fcntl.h>
#ifdef HAVE_IPV6
#include <sys/socket.h>
#endif
char *myFgets(char *buffer, int bufferSize, FILE * fp) char *myFgets(char *buffer, int bufferSize, FILE * fp)
{ {
char *ret = fgets(buffer, bufferSize, fp); char *ret = fgets(buffer, bufferSize, fp);

View File

@ -20,7 +20,12 @@
#define UTILS_H #define UTILS_H
#include "gcc.h" #include "gcc.h"
#include "os_compat.h"
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <pthread.h>
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))

View File

@ -19,7 +19,7 @@
#ifndef VOLUME_H #ifndef VOLUME_H
#define VOLUME_H #define VOLUME_H
#include "os_compat.h" #include <stdio.h>
#define VOLUME_MIXER_OSS "oss" #define VOLUME_MIXER_OSS "oss"
#define VOLUME_MIXER_ALSA "alsa" #define VOLUME_MIXER_ALSA "alsa"