Separate status and status_msg local variables

This commit is contained in:
Nigel Tao committed 2020-01-04 11:57:33 +11:00
1 parent fb54ba452f
commit c50f16e58b
10 files changed
+213 -212

No files matched your search

+9 -9
View File
@@ -273,8 +273,8 @@ const char* try_allocate(wuffs_gif__decoder* dec,
}
const char* allocate(wuffs_gif__decoder* dec, wuffs_base__image_config* ic) {
const char* status = try_allocate(dec, ic);
if (status) {
const char* status_msg = try_allocate(dec, ic);
if (status_msg) {
free(printbuf.ptr);
printbuf = wuffs_base__make_slice_u8(NULL, 0);
free(workbuf.ptr);
@@ -287,7 +287,7 @@ const char* allocate(wuffs_gif__decoder* dec, wuffs_base__image_config* ic) {
curr_dst_buffer = NULL;
dst_len = 0;
}
return status;
return status_msg;
}
const char* play() {
@@ -446,16 +446,16 @@ int main(int argc, char** argv) {
}
}
const char* status = read_stdin();
if (status) {
fprintf(stderr, "%s\n", status);
const char* status_msg = read_stdin();
if (status_msg) {
fprintf(stderr, "%s\n", status_msg);
return 1;
}
while (true) {
status = play();
if (status) {
fprintf(stderr, "%s\n", status);
status_msg = play();
if (status_msg) {
fprintf(stderr, "%s\n", status_msg);
return 1;
}
if (num_loops_remaining == 0) {
+3 -3
View File
@@ -118,9 +118,9 @@ static const char* decode() {
}
int main(int argc, char** argv) {
const char* status = decode();
if (status) {
fprintf(stderr, "%s\n", status);
const char* status_msg = decode();
if (status_msg) {
fprintf(stderr, "%s\n", status_msg);
return 1;
}
return 0;
+2 -2
View File
@@ -163,8 +163,8 @@ int main(int argc, char** argv) {
prctl(PR_SET_SECCOMP, SECCOMP_MODE_STRICT);
#endif
const char* status = decode();
int status_code = status ? fail(status) : 0;
const char* status_msg = decode();
int status_code = status_msg ? fail(status_msg) : 0;
#if defined(WUFFS_EXAMPLE_USE_SECCOMP)
// Call SYS_exit explicitly instead of SYS_exit_group implicitly.