diff --git a/extlib/benz/eval.c b/extlib/benz/eval.c index 8fd8adbc..7a55ab54 100644 --- a/extlib/benz/eval.c +++ b/extlib/benz/eval.c @@ -10,7 +10,7 @@ static pic_value pic_compile(pic_state *, pic_value); -#define EQ(sym, lit) (strcmp(pic_str(pic, pic_sym_name(pic, sym)), lit) == 0) +#define EQ(sym, lit) (strcmp(pic_sym(pic, sym), lit) == 0) #define S(lit) (pic_intern_lit(pic, lit)) static void diff --git a/extlib/benz/include/picrin.h b/extlib/benz/include/picrin.h index 1d5e1ad9..f255d2e3 100644 --- a/extlib/benz/include/picrin.h +++ b/extlib/benz/include/picrin.h @@ -122,6 +122,7 @@ double pic_float(pic_state *, pic_value f); char pic_char(pic_state *, pic_value c); #define pic_bool(pic,b) (! pic_false_p(pic, b)) const char *pic_str(pic_state *, pic_value str); +#define pic_sym(pic,s) (pic_str(pic, pic_sym_name(pic, (s)))) unsigned char *pic_blob(pic_state *, pic_value blob, int *len); void *pic_data(pic_state *, pic_value data); diff --git a/extlib/benz/read.c b/extlib/benz/read.c index 2325e0f8..5db65c72 100644 --- a/extlib/benz/read.c +++ b/extlib/benz/read.c @@ -339,10 +339,10 @@ read_minus(pic_state *pic, xFILE *file, int c, struct reader_control *p) } else { sym = read_symbol(pic, file, c, p); - if (strcaseeq(pic_str(pic, pic_sym_name(pic, sym)), "-inf.0")) { + if (strcaseeq(pic_sym(pic, sym), "-inf.0")) { return pic_float_value(pic, -(1.0 / 0.0)); } - if (strcaseeq(pic_str(pic, pic_sym_name(pic, sym)), "-nan.0")) { + if (strcaseeq(pic_sym(pic, sym), "-nan.0")) { return pic_float_value(pic, -(0.0 / 0.0)); } return sym; @@ -359,10 +359,10 @@ read_plus(pic_state *pic, xFILE *file, int c, struct reader_control *p) } else { sym = read_symbol(pic, file, c, p); - if (strcaseeq(pic_str(pic, pic_sym_name(pic, sym)), "+inf.0")) { + if (strcaseeq(pic_sym(pic, sym), "+inf.0")) { return pic_float_value(pic, 1.0 / 0.0); } - if (strcaseeq(pic_str(pic, pic_sym_name(pic, sym)), "+nan.0")) { + if (strcaseeq(pic_sym(pic, sym), "+nan.0")) { return pic_float_value(pic, 0.0 / 0.0); } return sym; diff --git a/extlib/benz/write.c b/extlib/benz/write.c index ce56943c..bb993503 100644 --- a/extlib/benz/write.c +++ b/extlib/benz/write.c @@ -195,7 +195,7 @@ write_pair_help(pic_state *pic, pic_value pair, xFILE *file, struct writer_contr } } -#define EQ(sym, lit) (strcmp(pic_str(pic, pic_sym_name(pic, sym)), lit) == 0) +#define EQ(sym, lit) (strcmp(pic_sym(pic, sym), lit) == 0) static void write_pair(pic_state *pic, pic_value pair, xFILE *file, struct writer_control *p) @@ -273,7 +273,7 @@ write_dict(pic_state *pic, pic_value dict, xFILE *file, struct writer_control *p xfprintf(pic, file, "#.(dictionary"); while (pic_dict_next(pic, dict, &it, &key, &val)) { - xfprintf(pic, file, " '%s ", pic_str(pic, pic_sym_name(pic, key))); + xfprintf(pic, file, " '%s ", pic_sym(pic, key)); write_core(pic, val, file, p); } xfprintf(pic, file, ")"); @@ -319,7 +319,7 @@ write_core(pic_state *pic, pic_value obj, xFILE *file, struct writer_control *p) xfprintf(pic, file, "%d", pic_int(pic, obj)); break; case PIC_TYPE_SYMBOL: - xfprintf(pic, file, "%s", pic_str(pic, pic_sym_name(pic, obj))); + xfprintf(pic, file, "%s", pic_sym(pic, obj)); break; case PIC_TYPE_FLOAT: write_float(pic, obj, file);