X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fexpressions%2Fhelpers.c;h=fd78e734abe0eefde8c2206af5a2149faaf8dba3;hb=b74d09af5e07f954c18e7cdb8aca3af47fa10208;hp=9d0d18cab134185f5d5b4d308e21a7a5be12fef4;hpb=1b47c4afe993f715c03e7392427b0b8919a26d4e;p=pspp-builds.git diff --git a/src/language/expressions/helpers.c b/src/language/expressions/helpers.c index 9d0d18ca..fd78e734 100644 --- a/src/language/expressions/helpers.c +++ b/src/language/expressions/helpers.c @@ -5,24 +5,24 @@ #include #include "private.h" -const struct fixed_string empty_string = {NULL, 0}; +const struct substring empty_string = {NULL, 0}; static void expr_error (void *aux UNUSED, const char *format, ...) { - struct error e; + struct msg m; va_list args; /* FIXME: we can do better about saying where the error occurred. */ - e.category = MSG_SYNTAX; - e.severity = MSG_ERROR; - err_location (&e.where); - e.title = NULL; - + m.category = MSG_SYNTAX; + m.severity = MSG_ERROR; + msg_location (&m.where); va_start (args, format); - err_vmsg (&e, format, args); + m.text = xvasprintf (format, args); va_end (args); + + msg_emit (&m); } double @@ -121,7 +121,7 @@ expr_yrmoda (double year, double month, double day) } int -compare_string (const struct fixed_string *a, const struct fixed_string *b) +compare_string (const struct substring *a, const struct substring *b) { size_t i; @@ -149,19 +149,19 @@ count_valid (double *d, size_t d_cnt) return valid_cnt; } -struct fixed_string +struct substring alloc_string (struct expression *e, size_t length) { - struct fixed_string s; + struct substring s; s.length = length; s.string = pool_alloc (e->eval_pool, length); return s; } -struct fixed_string +struct substring copy_string (struct expression *e, const char *old, size_t length) { - struct fixed_string s = alloc_string (e, length); + struct substring s = alloc_string (e, length); memcpy (s.string, old, length); return s; }