From: Eric W. <war...@us...> - 2001-11-06 21:30:34
|
Update of /cvsroot/gaim/gaim/src In directory usw-pr-cvs1:/tmp/cvs-serv25428 Modified Files: sound.c Log Message: no goto!!!! Index: sound.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/sound.c,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- sound.c 2001/10/25 02:22:51 1.42 +++ sound.c 2001/11/06 21:30:31 1.43 @@ -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; } |