X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdictionary.c;h=6fbd5dfa575783efe2447225682fc6cbe1c055c6;hb=79e615c130eb0eaa23c7c220a51c3cf00e17b3a6;hp=d4ff2256e541dbfcf0738b094a2538e7c2e7ce18;hpb=0e8d6804cd1c81b397394358a9361b5efb883fc8;p=pspp diff --git a/src/dictionary.c b/src/dictionary.c index d4ff2256e5..6fbd5dfa57 100644 --- a/src/dictionary.c +++ b/src/dictionary.c @@ -268,7 +268,7 @@ dict_create_var (struct dictionary *d, const char *name, int width) /* Allocate and initialize variable. */ v = xmalloc (sizeof *v); - st_trim_copy (v->name, name, sizeof v->name); + str_copy_trunc (v->name, sizeof v->name, name); v->type = width == 0 ? NUMERIC : ALPHA; v->width = width; v->fv = d->next_value_idx; @@ -279,20 +279,14 @@ dict_create_var (struct dictionary *d, const char *name, int width) v->miss_type = MISSING_NONE; if (v->type == NUMERIC) { - v->print.type = FMT_F; - v->print.w = 8; - v->print.d = 2; - + v->print = f8_2; v->alignment = ALIGN_RIGHT; v->display_width = 8; v->measure = MEASURE_SCALE; } else { - v->print.type = FMT_A; - v->print.w = v->width; - v->print.d = 0; - + v->print = make_output_format (FMT_A, v->width, 0); v->alignment = ALIGN_LEFT; v->display_width = 8; v->measure = MEASURE_NOMINAL; @@ -395,7 +389,7 @@ dict_lookup_var (const struct dictionary *d, const char *name) assert (d != NULL); assert (name != NULL); - st_trim_copy (v.name, name, sizeof v.name); + str_copy_trunc (v.name, sizeof v.name, name); return hsh_find (d->name_tab, &v); } @@ -569,7 +563,7 @@ dict_rename_var (struct dictionary *d, struct variable *v, || dict_lookup_var (d, new_name) == NULL); hsh_force_delete (d->name_tab, v); - st_trim_copy (v->name, new_name, sizeof v->name); + str_copy_trunc (v->name, sizeof v->name, new_name); hsh_force_insert (d->name_tab, v); if (get_algorithm () == ENHANCED) @@ -970,7 +964,7 @@ dict_create_vector (struct dictionary *d, d->vector = xrealloc (d->vector, (d->vector_cnt + 1) * sizeof *d->vector); vector = d->vector[d->vector_cnt] = xmalloc (sizeof *vector); vector->idx = d->vector_cnt++; - st_trim_copy (vector->name, name, sizeof vector->name); + str_copy_trunc (vector->name, sizeof vector->name, name); vector->var = xmalloc (cnt * sizeof *var); for (i = 0; i < cnt; i++) {