X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fdictionary.c;h=c8f58516ecc79d1d6a7bc78a29353f838745634c;hb=d9fc15ceb74cdc66487ba9aaed04246170729640;hp=7d67defbfecfc61fa3f3637ecfbb94c127c4b75a;hpb=7731fa51f095e615975cd53d35ba3cb681b82df1;p=pspp-builds.git diff --git a/src/data/dictionary.c b/src/data/dictionary.c index 7d67defb..c8f58516 100644 --- a/src/data/dictionary.c +++ b/src/data/dictionary.c @@ -87,16 +87,6 @@ struct dictionary static void dict_unset_split_var (struct dictionary *, struct variable *); static void dict_unset_mrset_var (struct dictionary *, struct variable *); -void -dict_set_encoding (struct dictionary *d, const char *enc) -{ - if (enc) - { - free (d->encoding); - d->encoding = xstrdup (enc); - } -} - const char * dict_get_encoding (const struct dictionary *d) { @@ -171,14 +161,16 @@ dict_copy_callbacks (struct dictionary *dest, dest->cb_data = src->cb_data; } -/* Creates and returns a new dictionary. */ +/* Creates and returns a new dictionary with the specified ENCODING. */ struct dictionary * -dict_create (void) +dict_create (const char *encoding) { struct dictionary *d = xzalloc (sizeof *d); + d->encoding = xstrdup (encoding); hmap_init (&d->name_map); attrset_init (&d->attributes); + return d; } @@ -196,7 +188,7 @@ dict_clone (const struct dictionary *s) struct dictionary *d; size_t i; - d = dict_create (); + d = dict_create (s->encoding); /* Set the new dictionary's encoding early so that string length limitations are interpreted correctly. */ @@ -1660,7 +1652,7 @@ struct variable * dict_create_internal_var (int case_idx, int width) { if (internal_dict == NULL) - internal_dict = dict_create (); + internal_dict = dict_create ("UTF-8"); for (;;) {