Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Removed uses of stdlib.h and string.h
  • Loading branch information
slouken committed Feb 7, 2006
1 parent 8ae50e0 commit 07c43c5
Show file tree
Hide file tree
Showing 192 changed files with 455 additions and 666 deletions.
2 changes: 1 addition & 1 deletion src/SDL.c
Expand Up @@ -27,9 +27,9 @@
#endif

#include "SDL.h"
#include "SDL_stdlib.h"
#include "SDL_endian.h"
#include "SDL_fatal.h"
#include "SDL_stdlib.h"
#ifndef DISABLE_VIDEO
#include "SDL_leaks.h"
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/SDL_error.c
Expand Up @@ -22,9 +22,9 @@

/* Simple error handling in SDL */

#include "SDL_types.h"
#include "SDL_stdlib.h"
#include "SDL_string.h"
#include "SDL_types.h"
#include "SDL_error.h"
#include "SDL_error_c.h"
#ifndef DISABLE_THREADS
Expand Down
14 changes: 7 additions & 7 deletions src/audio/SDL_audiodev.c
Expand Up @@ -24,13 +24,12 @@

#if defined(unix) || defined(__unix__) || defined(__riscos__)

#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>

#include "SDL_stdlib.h"
#include "SDL_string.h"
#include "SDL_audiodev_c.h"

#ifndef _PATH_DEV_DSP
Expand Down Expand Up @@ -80,7 +79,8 @@ int SDL_OpenAudioPath(char *path, int maxlen, int flags, int classic)

instance = 1;
do { /* Don't use errno ENOENT - it may not be thread-safe */
sprintf(audiopath, "%s%d", audiodev, instance++);
SDL_snprintf(audiopath, SDL_arraysize(audiopath),
"%s%d", audiodev, instance++);
exists = 0;
if ( stat(audiopath, &sb) == 0 ) {
exists = 1;
Expand All @@ -100,11 +100,11 @@ int SDL_OpenAudioPath(char *path, int maxlen, int flags, int classic)

/* Get the name of the audio device we use for output */

#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>

#include "SDL_stdlib.h"
#include "SDL_string.h"
#include "SDL_audiodev_c.h"

#ifndef _PATH_DEV_DSP
Expand Down Expand Up @@ -158,7 +158,7 @@ int SDL_OpenAudioPath(char *path, int maxlen, int flags, int classic)

cycle = 0;
while( devsettings[cycle][0] != '\0' ) {
sprintf( audiopath,
SDL_snprintf( audiopath, SDL_arraysize(audiopath),
_PATH_DEV_DSP,
devsettings[cycle][0],
devsettings[cycle][1],
Expand Down
2 changes: 1 addition & 1 deletion src/audio/SDL_audiomem.c
Expand Up @@ -31,8 +31,8 @@
#include <stddef.h>
#endif

#include "SDL_audiomem.h"
#include "SDL_stdlib.h"
#include "SDL_audiomem.h"

/* Allocate memory that will be shared between threads (freed on exit) */
void *SDL_AllocAudioMem(int size)
Expand Down
4 changes: 2 additions & 2 deletions src/audio/SDL_wave.c
Expand Up @@ -24,10 +24,10 @@

/* Microsoft WAVE file loading routines */

#include "SDL_error.h"
#include "SDL_audio.h"
#include "SDL_stdlib.h"
#include "SDL_string.h"
#include "SDL_error.h"
#include "SDL_audio.h"
#include "SDL_wave.h"
#include "SDL_endian.h"

Expand Down
11 changes: 3 additions & 8 deletions src/audio/alsa/SDL_alsa_audio.c
Expand Up @@ -24,16 +24,11 @@

/* Allow access to a raw mixing buffer */

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/time.h>
#include <signal.h> /* For kill() */

#include "SDL_stdlib.h"
#include "SDL_string.h"
#include "SDL_audio.h"
#include "SDL_error.h"
#include "SDL_audiomem.h"
Expand Down
2 changes: 0 additions & 2 deletions src/audio/amigaos/SDL_ahiaudio.h
Expand Up @@ -30,8 +30,6 @@
#else
#include <inline/exec.h>
#endif
#include <stdlib.h>
#include <string.h>

#include <devices/ahi.h>
#include "mydebug.h"
Expand Down
10 changes: 2 additions & 8 deletions src/audio/arts/SDL_artsaudio.c
Expand Up @@ -22,14 +22,8 @@

/* Allow access to a raw mixing buffer */

#include <sys/types.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <unistd.h>

#include "SDL_stdlib.h"
#include "SDL_string.h"
#include "SDL_audio.h"
#include "SDL_error.h"
#include "SDL_audiomem.h"
Expand Down
5 changes: 2 additions & 3 deletions src/audio/baudio/SDL_beaudio.cc
Expand Up @@ -22,15 +22,14 @@

/* Allow access to the audio stream on BeOS */

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <SoundPlayer.h>

#include "SDL_BeApp.h"

extern "C" {

#include "SDL_stdlib.h"
#include "SDL_string.h"
#include "SDL_audio.h"
#include "SDL_audio_c.h"
#include "SDL_sysaudio.h"
Expand Down
6 changes: 2 additions & 4 deletions src/audio/dart/SDL_dart.c
Expand Up @@ -22,10 +22,8 @@

/* Allow access to a raw mixing buffer */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "SDL_stdlib.h"
#include "SDL_string.h"
#include "SDL_types.h"
#include "SDL_error.h"
#include "SDL_timer.h"
Expand Down
6 changes: 2 additions & 4 deletions src/audio/dc/SDL_dcaudio.c
Expand Up @@ -23,17 +23,15 @@

/* Output dreamcast aica */

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>


#include "SDL_stdlib.h"
#include "SDL_string.h"
#include "SDL_audio.h"
#include "SDL_error.h"
#include "SDL_audiomem.h"
Expand Down
4 changes: 2 additions & 2 deletions src/audio/disk/SDL_diskaudio.c
Expand Up @@ -25,9 +25,7 @@

/* Output raw audio data to a file. */

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <sys/stat.h>
Expand All @@ -36,6 +34,8 @@
#include <fcntl.h>


#include "SDL_stdlib.h"
#include "SDL_string.h"
#include "SDL_audio.h"
#include "SDL_error.h"
#include "SDL_audiomem.h"
Expand Down
4 changes: 2 additions & 2 deletions src/audio/dma/SDL_dmaaudio.c
Expand Up @@ -22,9 +22,7 @@

/* Allow access to a raw mixing buffer */

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
Expand All @@ -46,6 +44,8 @@
#define MAP_FAILED ((Uint8 *)-1)
#endif

#include "SDL_stdlib.h"
#include "SDL_string.h"
#include "SDL_audio.h"
#include "SDL_error.h"
#include "SDL_audiomem.h"
Expand Down
4 changes: 2 additions & 2 deletions src/audio/dmedia/SDL_irixaudio.c
Expand Up @@ -23,8 +23,8 @@
/* Allow access to a raw mixing buffer (For IRIX 6.5 and higher) */
/* patch for IRIX 5 by Georg Schwarz 18/07/2004 */

#include <stdlib.h>

#include "SDL_stdlib.h"
#include "SDL_string.h"
#include "SDL_endian.h"
#include "SDL_timer.h"
#include "SDL_audio.h"
Expand Down
7 changes: 3 additions & 4 deletions src/audio/dsp/SDL_dspaudio.c
Expand Up @@ -25,9 +25,7 @@

/* Allow access to a raw mixing buffer */

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdio.h> /* For perror() ... should we really do this? */
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
Expand All @@ -43,6 +41,8 @@
#include <sys/soundcard.h>
#endif

#include "SDL_stdlib.h"
#include "SDL_string.h"
#include "SDL_audio.h"
#include "SDL_error.h"
#include "SDL_audiomem.h"
Expand Down Expand Up @@ -303,7 +303,6 @@ static int DSP_OpenAudio(_THIS, SDL_AudioSpec *spec)
#endif
if ( ioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &frag_spec) < 0 ) {
perror("SNDCTL_DSP_SETFRAGMENT");
fprintf(stderr, "Warning: Couldn't set audio fragment size\n");
}
#ifdef DEBUG_AUDIO
{ audio_buf_info info;
Expand Down
9 changes: 3 additions & 6 deletions src/audio/esd/SDL_esdaudio.c
Expand Up @@ -24,15 +24,12 @@

#ifdef ESD_SUPPORT

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <unistd.h>

#include <esd.h>

#include "SDL_stdlib.h"
#include "SDL_string.h"
#include "SDL_audio.h"
#include "SDL_error.h"
#include "SDL_audiomem.h"
Expand Down Expand Up @@ -257,7 +254,7 @@ static char *get_progname(void)
FILE *fp;
static char temp[BUFSIZ];

sprintf(temp, "/proc/%d/cmdline", getpid());
SDL_snprintf(temp, SDL_arraysize(temp), "/proc/%d/cmdline", getpid());
fp = fopen(temp, "r");
if ( fp != NULL ) {
if ( fgets(temp, sizeof(temp)-1, fp) ) {
Expand Down
12 changes: 5 additions & 7 deletions src/audio/macosx/SDL_coreaudio.c
Expand Up @@ -22,11 +22,8 @@

#include <AudioUnit/AudioUnit.h>

#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include "SDL_stdlib.h"
#include "SDL_string.h"
#include "SDL_endian.h"
#include "SDL_audio.h"
#include "SDL_audio_c.h"
Expand Down Expand Up @@ -113,8 +110,10 @@ static OSStatus audioCallback (void *inRefCon,
/* No SDL conversion should be needed here, ever, since we accept
any input format in OpenAudio, and leave the conversion to CoreAudio.
*/
/*
assert(!this->convert.needed);
assert(this->spec.channels == ioData->mNumberChannels);
*/

remaining = ioData->mDataByteSize;
ptr = ioData->mData;
Expand Down Expand Up @@ -270,8 +269,7 @@ int Core_OpenAudio(_THIS, SDL_AudioSpec *spec)
/* Allocate a sample buffer */
bufferOffset = bufferSize = this->spec.size;
buffer = SDL_malloc(bufferSize);
assert(buffer);


/* Finally, start processing of the audio unit */
result = AudioOutputUnitStart (outputAudioUnit);
CHECK_RESULT("AudioOutputUnitStart")
Expand Down
7 changes: 3 additions & 4 deletions src/audio/macrom/SDL_romaudio.c
Expand Up @@ -30,9 +30,6 @@
# include <DriverServices.h>
#endif

#include <stdlib.h>
#include <stdio.h>

#if !defined(NewSndCallBackUPP) && (UNIVERSAL_INTERFACES_VERSION < 0x0335)
#if !defined(NewSndCallBackProc) /* avoid circular redefinition... */
#define NewSndCallBackUPP NewSndCallBackProc
Expand All @@ -42,6 +39,8 @@
#endif
#endif

#include "SDL_stdlib.h"
#include "SDL_string.h"
#include "SDL_endian.h"
#include "SDL_audio.h"
#include "SDL_audio_c.h"
Expand Down Expand Up @@ -455,7 +454,7 @@ static int Mac_OpenAudio(_THIS, SDL_AudioSpec *spec)

/* allocate the 2 double-back buffers */
for ( i=0; i<2; ++i ) {
audio_buf[i] = calloc(1, sizeof(SndDoubleBuffer)+spec->size);
audio_buf[i] = SDL_calloc(1, sizeof(SndDoubleBuffer)+spec->size);
if ( audio_buf[i] == NULL ) {
SDL_OutOfMemory();
return(-1);
Expand Down
6 changes: 2 additions & 4 deletions src/audio/mint/SDL_mintaudio_dma8.c
Expand Up @@ -27,15 +27,13 @@
Patrice Mandin
*/

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

/* Mint includes */
#include <mint/osbind.h>
#include <mint/falcon.h>
#include <mint/cookie.h>

#include "SDL_stdlib.h"
#include "SDL_string.h"
#include "SDL_endian.h"
#include "SDL_audio.h"
#include "SDL_audio_c.h"
Expand Down
6 changes: 2 additions & 4 deletions src/audio/mint/SDL_mintaudio_gsxb.c
Expand Up @@ -27,15 +27,13 @@
Patrice Mandin
*/

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

/* Mint includes */
#include <mint/osbind.h>
#include <mint/falcon.h>
#include <mint/cookie.h>

#include "SDL_stdlib.h"
#include "SDL_string.h"
#include "SDL_endian.h"
#include "SDL_audio.h"
#include "SDL_audio_c.h"
Expand Down

0 comments on commit 07c43c5

Please sign in to comment.