diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-04-28 22:36:32 +0900 |
|---|---|---|
| committer | Hiroshi Mimaki <[email protected]> | 2020-05-07 09:37:02 +0900 |
| commit | 5e01674b72cf8205a94e157af893dcd34e27a306 (patch) | |
| tree | 57b431826d3fe988ab23c66ff5b2c08abc3ba1c0 /mrbgems | |
| parent | b652a4ff1426d8832f2678e7a00de43b3b0aea4c (diff) | |
| download | mruby-5e01674b72cf8205a94e157af893dcd34e27a306.tar.gz mruby-5e01674b72cf8205a94e157af893dcd34e27a306.zip | |
Should not use `assert` with expressions with side-effect; ref #49812.1.1-rc2
`assert()` can be completely removed when `NDEBUG` is set.
Diffstat (limited to 'mrbgems')
| -rw-r--r-- | mrbgems/mruby-io/test/mruby_io_test.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/mrbgems/mruby-io/test/mruby_io_test.c b/mrbgems/mruby-io/test/mruby_io_test.c index 7165d09cc..4dce48c26 100644 --- a/mrbgems/mruby-io/test/mruby_io_test.c +++ b/mrbgems/mruby-io/test/mruby_io_test.c @@ -53,7 +53,6 @@ mkdtemp(char *temp) #include <sys/socket.h> #include <unistd.h> #include <sys/un.h> - #include <assert.h> #include <fcntl.h> #endif @@ -117,10 +116,8 @@ mrb_io_test_io_setup(mrb_state *mrb, mrb_value self) char *tmpdir; wd_save = open(".", O_DIRECTORY); tmpdir = getenv("TMPDIR"); - if (tmpdir) - assert(!chdir(tmpdir)); - else - assert(!chdir("/tmp")); + if (tmpdir) chdir(tmpdir); + else chdir("/tmp"); } #endif @@ -220,7 +217,7 @@ mrb_io_test_io_cleanup(mrb_state *mrb, mrb_value self) #if !defined(_WIN32) && !defined(_WIN64) if(!socket_available_p) { - assert(!fchdir(wd_save)); + fchdir(wd_save); close(wd_save); } #endif |
