don't use pic_false_p if possible

This commit is contained in:
Yuichi Nishiwaki 2016-02-20 15:34:49 +09:00
parent f4efaf5dc0
commit c57655c7ac
2 changed files with 15 additions and 11 deletions

View File

@ -174,12 +174,13 @@ static pic_value
pic_lib_library_import(pic_state *pic) pic_lib_library_import(pic_state *pic)
{ {
const char *lib; const char *lib;
pic_value name, alias = pic_false_value(pic), realname, uid; pic_value name, alias, realname, uid;
struct pic_lib *libp; struct pic_lib *libp;
int n;
pic_get_args(pic, "zm|m", &lib, &name, &alias); n = pic_get_args(pic, "zm|m", &lib, &name, &alias);
if (pic_false_p(pic, alias)) { if (n == 2) {
alias = name; alias = name;
} }
@ -205,10 +206,11 @@ static pic_value
pic_lib_library_export(pic_state *pic) pic_lib_library_export(pic_state *pic)
{ {
pic_value name, alias = pic_false_value(pic); pic_value name, alias = pic_false_value(pic);
int n;
pic_get_args(pic, "m|m", &name, &alias); n = pic_get_args(pic, "m|m", &name, &alias);
if (pic_false_p(pic, alias)) { if (n == 1) {
alias = name; alias = name;
} }

View File

@ -561,12 +561,13 @@ pic_pair_memv(pic_state *pic)
static pic_value static pic_value
pic_pair_member(pic_state *pic) pic_pair_member(pic_state *pic)
{ {
pic_value key, list, proc = pic_false_value(pic); pic_value key, list, proc;
int n;
pic_get_args(pic, "oo|l", &key, &list, &proc); n = pic_get_args(pic, "oo|l", &key, &list, &proc);
while (! pic_nil_p(pic, list)) { while (! pic_nil_p(pic, list)) {
if (pic_false_p(pic, proc)) { if (n == 2) {
if (pic_equal_p(pic, key, pic_car(pic, list))) if (pic_equal_p(pic, key, pic_car(pic, list)))
return list; return list;
} else { } else {
@ -615,13 +616,14 @@ pic_pair_assv(pic_state *pic)
static pic_value static pic_value
pic_pair_assoc(pic_state *pic) pic_pair_assoc(pic_state *pic)
{ {
pic_value key, alist, proc = pic_false_value(pic), cell; pic_value key, alist, proc, cell;
int n;
pic_get_args(pic, "oo|l", &key, &alist, &proc); n = pic_get_args(pic, "oo|l", &key, &alist, &proc);
while (! pic_nil_p(pic, alist)) { while (! pic_nil_p(pic, alist)) {
cell = pic_car(pic, alist); cell = pic_car(pic, alist);
if (pic_false_p(pic, proc)) { if (n == 2) {
if (pic_equal_p(pic, key, pic_car(pic, cell))) if (pic_equal_p(pic, key, pic_car(pic, cell)))
return cell; return cell;
} else { } else {