aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test/init_SUITE.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-10-12 15:14:14 +0200
committerBjörn Gustavsson <[email protected]>2015-12-16 15:52:25 +0100
commite1dc0aa4100f881f4350162bd523c53d38f08b8f (patch)
tree846ac02c1c4636f4f7b275d91c590d343188e5a7 /lib/kernel/test/init_SUITE.erl
parent27b921fef54b7410efdf756d6ad20ce2877fbc6b (diff)
downloadotp-e1dc0aa4100f881f4350162bd523c53d38f08b8f.tar.gz
otp-e1dc0aa4100f881f4350162bd523c53d38f08b8f.tar.bz2
otp-e1dc0aa4100f881f4350162bd523c53d38f08b8f.zip
Simplify get_flag() and get_flag_list()
The get_flag/3 function which returns a default value if the flag doesn't exist, is implemented in terms of get_flag/2 which throws an exception if the flag doesn't exist. get_flag/3 is frequently used for the flags that don't exist, which means that means that an exception will be generated and catched for no good reason. Reimplement get_flag/3 so that it doesn't have to call get_flag/2 and catch an exception. Eliminate the get_flag/2 function by writing a special purpose function for the only time it's used, that is for retrieving the value for the -root flag. As a side-effect, we will get a nicer error message if there is something wrong with the -root flag. Similarly, simplify get_flag_list/3 and remove get_flag_list/2. We can also eliminate search/3 and use the lists:keyfind/3 BIF instead.
Diffstat (limited to 'lib/kernel/test/init_SUITE.erl')
0 files changed, 0 insertions, 0 deletions