X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fvariable.c;h=17a1542cbc3d7a7bf7f20d2ce3ce7747647d4c78;hb=97fed7964411b7bed4d8ad5bc895966de7e6b2b3;hp=c83c31ad72fb4d4dc21b1b001b5df176be8715d2;hpb=924870103590032b33a94b471fc90ed08f4072c6;p=pspp-builds.git diff --git a/src/data/variable.c b/src/data/variable.c index c83c31ad..17a1542c 100644 --- a/src/data/variable.c +++ b/src/data/variable.c @@ -782,10 +782,12 @@ var_get_short_name (const struct variable *var, size_t idx) return idx < var->short_name_cnt ? var->short_names[idx] : NULL; } -/* Sets VAR's short name with the given IDX to SHORT_NAME, - truncating it to SHORT_NAME_LEN characters and converting it - to uppercase in the process. Specifying a null pointer for - SHORT_NAME clears the specified short name. */ +/* Sets VAR's short name with the given IDX to the UTF-8 string SHORT_NAME. + The caller must already have checked that, in the dictionary encoding, + SHORT_NAME is no more than SHORT_NAME_LEN bytes long. The new short name + will be converted to uppercase. + + Specifying a null pointer for SHORT_NAME clears the specified short name. */ void var_set_short_name (struct variable *var, size_t idx, const char *short_name) { @@ -811,7 +813,7 @@ var_set_short_name (struct variable *var, size_t idx, const char *short_name) for (i = old_cnt; i < var->short_name_cnt; i++) var->short_names[i] = NULL; } - var->short_names[idx] = xstrndup (short_name, MAX_SHORT_STRING); + var->short_names[idx] = xstrdup (short_name); str_uppercase (var->short_names[idx]); }