Cleanup: use ELEM macro for path slash checks

This commit is contained in:
Campbell Barton
2020-03-07 00:58:48 +11:00
parent b4f1edd98b
commit a5bbdd6998
3 changed files with 14 additions and 16 deletions

View File

@@ -152,8 +152,7 @@ void python_script_error_jump(const char *filepath, int *lineno, int *offset)
const char *filename = _PyUnicode_AsString(filename_py);
/* python adds a '/', prefix, so check for both */
if ((BLI_path_cmp(filename, filepath) == 0) ||
((filename[0] == '\\' || filename[0] == '/') &&
BLI_path_cmp(filename + 1, filepath) == 0)) {
(ELEM(filename[0], '\\', '/') && BLI_path_cmp(filename + 1, filepath) == 0)) {
/* good */
}
else {
@@ -177,7 +176,7 @@ void python_script_error_jump(const char *filepath, int *lineno, int *offset)
PyObject *coerce;
const char *tb_filepath = traceback_filepath(tb, &coerce);
const int match = ((BLI_path_cmp(tb_filepath, filepath) == 0) ||
((tb_filepath[0] == '\\' || tb_filepath[0] == '/') &&
(ELEM(tb_filepath[0], '\\', '/') &&
BLI_path_cmp(tb_filepath + 1, filepath) == 0));
Py_DECREF(coerce);