1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

glob_make_pattern: do not goto into a branch

I'm not necessarily against every goto in general, but jumping into a
branch is definitely a bad idea.  Better refactor.
This commit is contained in:
卜部昌平 2020-06-12 14:00:35 +09:00
parent 9c92dcf366
commit 70857ae1aa
Notes: git 2020-06-29 11:07:09 +09:00

10
dir.c
View file

@ -1705,10 +1705,7 @@ glob_make_pattern(const char *p, const char *e, int flags, rb_encoding *enc)
tmp = GLOB_ALLOC(struct glob_pattern);
if (!tmp) {
error:
*tail = 0;
glob_free_pattern(list);
return 0;
goto error;
}
tmp->type = dirsep ? MATCH_DIR : MATCH_ALL;
tmp->str = 0;
@ -1716,6 +1713,11 @@ glob_make_pattern(const char *p, const char *e, int flags, rb_encoding *enc)
tmp->next = 0;
return list;
error:
*tail = 0;
glob_free_pattern(list);
return 0;
}
static void