# HG changeset patch # User Eric Warmenhoven # Date 1005082231 0 # Node ID ab2ca2770d2e9765f9a230bac17c126881191cdc # Parent 94aa499ecd39040638dba0dfe9942e550770b29e [gaim-migrate @ 2693] no goto!!!! committer: Tailor Script diff -r 94aa499ecd39 -r ab2ca2770d2e src/sound.c --- a/src/sound.c Tue Nov 06 04:40:21 2001 +0000 +++ b/src/sound.c Tue Nov 06 21:30:31 2001 +0000 @@ -247,33 +247,39 @@ int result = 0; int fd = -1; + if (!can_play_artsc()) + return 0; + fd = open(file, O_RDONLY); if (fd < 0) - goto out; - - if (!can_play_artsc()) - goto out; + return 0; - if (fstat(fd, &stat_buf)) - goto out; + if (fstat(fd, &stat_buf)) { + close(fd); + return 0; + } - if (!stat_buf.st_size) - goto out; + if (!stat_buf.st_size) { + close(fd); + return 0; + } buf = g_malloc(stat_buf.st_size); - if (!buf) - goto out; + if (!buf) { + close(fd); + return 0; + } - if (read(fd, buf, stat_buf.st_size) < 0) - goto out; + if (read(fd, buf, stat_buf.st_size) < 0) { + g_free(buf); + close(fd); + return 0; + } result = play_artsc(buf, stat_buf.st_size); - out: - if (buf) - g_free(buf); - if (fd != -1) - close(fd); + g_free(buf); + close(fd); return result; }