goto cleanup and define

Removed pointless goto.
Made use of BUFFER_SIZE define.

Untested.

Signed-off-by: Mahyar Koshkouei <deltabeard@users.noreply.github.com>
This commit is contained in:
Mahyar Koshkouei
2016-10-24 23:08:22 +01:00
parent 7fe6bc50ac
commit 69cd402df1

View File

@@ -10,7 +10,7 @@
#include <3ds.h> #include <3ds.h>
#include <stdio.h> #include <stdio.h>
#define BUFFER_SIZE 64 * 1024 * 1024 #define BUFFER_SIZE 1131072
int playWav(const char *wav); int playWav(const char *wav);
@@ -24,7 +24,7 @@ int main()
if(R_FAILED(csndInit())) if(R_FAILED(csndInit()))
{ {
printf("Error %d: Could not initialize CSND.", __LINE__); printf("Error %d: Could not initialize CSND.", __LINE__);
goto err; goto out;
} }
else else
puts("CSND initialized."); puts("CSND initialized.");
@@ -80,10 +80,6 @@ out:
csndExit(); csndExit();
gfxExit(); gfxExit();
return 0; return 0;
err:
puts("An error occurred. Exiting in 5 seconds.");
goto out;
} }
/** /**
@@ -109,8 +105,8 @@ int playWav(const char *wav)
fseek(file, 0, SEEK_SET); fseek(file, 0, SEEK_SET);
printf("Got to line %d. Size: %d\n", __LINE__, size); printf("Got to line %d. Size: %d\n", __LINE__, size);
if(size > 1131072) if(size > BUFFER_SIZE)
size = 1131072; size = BUFFER_SIZE;
printf("Got to line %d\n", __LINE__); printf("Got to line %d\n", __LINE__);
buffer = linearAlloc(size); buffer = linearAlloc(size);