X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fexpressions%2Foptimize.c;h=d80f4069b87a4cbfe1e7155f9ff3d4c8684a9848;hb=38f8cf3544615efabc0913ebd00fdf6053cf294d;hp=9f9626bc06329c95a3b75312eb60b7aa149d8e8b;hpb=a19b858e0ac3c69e4a28c0ca6d8674427268a863;p=pspp diff --git a/src/language/expressions/optimize.c b/src/language/expressions/optimize.c index 9f9626bc06..d80f4069b8 100644 --- a/src/language/expressions/optimize.c +++ b/src/language/expressions/optimize.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -44,7 +45,7 @@ expr_optimize (union any_node *node, struct expression *e) { int nonconst_cnt = 0; /* Number of nonconstant children. */ int sysmis_cnt = 0; /* Number of system-missing children. */ - struct operation *op; + const struct operation *op; struct composite_node *c; int i; @@ -141,9 +142,9 @@ static double get_number_arg (struct composite_node *, size_t arg_idx); static double *get_number_args (struct composite_node *, size_t arg_idx, size_t arg_cnt, struct expression *); -static struct fixed_string get_string_arg (struct composite_node *, +static struct substring get_string_arg (struct composite_node *, size_t arg_idx); -static struct fixed_string *get_string_args (struct composite_node *, +static struct substring *get_string_args (struct composite_node *, size_t arg_idx, size_t arg_cnt, struct expression *); static const struct fmt_spec *get_format_arg (struct composite_node *, @@ -157,12 +158,10 @@ evaluate_tree (struct composite_node *node, struct expression *e) #include "optimize.inc" default: - assert (0); + NOT_REACHED (); } - /* Not reached. */ - assert (0); - abort (); + NOT_REACHED (); } static double @@ -187,7 +186,7 @@ get_number_args (struct composite_node *c, size_t arg_idx, size_t arg_cnt, return d; } -static struct fixed_string +static struct substring get_string_arg (struct composite_node *c, size_t arg_idx) { assert (arg_idx < c->arg_cnt); @@ -195,11 +194,11 @@ get_string_arg (struct composite_node *c, size_t arg_idx) return c->args[arg_idx]->string.s; } -static struct fixed_string * +static struct substring * get_string_args (struct composite_node *c, size_t arg_idx, size_t arg_cnt, struct expression *e) { - struct fixed_string *s; + struct substring *s; size_t i; s = pool_alloc (e->expr_pool, sizeof *s * arg_cnt); @@ -236,7 +235,7 @@ emit_number (struct expression *e, double n) } static void -emit_string (struct expression *e, struct fixed_string s) +emit_string (struct expression *e, struct substring s) { allocate_aux (e, OP_string)->string = s; } @@ -302,14 +301,14 @@ flatten_atom (union any_node *n, struct expression *e) break; default: - abort (); + NOT_REACHED (); } } static void flatten_composite (union any_node *n, struct expression *e) { - struct operation *op = &operations[n->type]; + const struct operation *op = &operations[n->type]; size_t i; for (i = 0; i < n->composite.arg_cnt; i++) @@ -363,7 +362,7 @@ flatten_node (union any_node *n, struct expression *e) else if (is_composite (n->type)) flatten_composite (n, e); else - abort (); + NOT_REACHED (); } static union operation_data *