projects
/
pspp-builds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Test for NULL before calling strdup
[pspp-builds.git]
/
src
/
data
/
dictionary.c
diff --git
a/src/data/dictionary.c
b/src/data/dictionary.c
index ba840898112494b775d02c810edee29c98037fee..6e377f803212a6fbdce251ce17b36f3121e28177 100644
(file)
--- a/
src/data/dictionary.c
+++ b/
src/data/dictionary.c
@@
-63,6
+63,9
@@
struct dictionary
struct vector **vector; /* Vectors of variables. */
size_t vector_cnt; /* Number of vectors. */
struct attrset attributes; /* Custom attributes. */
struct vector **vector; /* Vectors of variables. */
size_t vector_cnt; /* Number of vectors. */
struct attrset attributes; /* Custom attributes. */
+
+ char *encoding; /* Character encoding of string data */
+
const struct dict_callbacks *callbacks; /* Callbacks on dictionary
modification */
void *cb_data ; /* Data passed to callbacks */
const struct dict_callbacks *callbacks; /* Callbacks on dictionary
modification */
void *cb_data ; /* Data passed to callbacks */
@@
-71,6
+74,20
@@
struct dictionary
void *changed_data;
};
void *changed_data;
};
+
+void
+dict_set_encoding (struct dictionary *d, const char *enc)
+{
+ d->encoding = strdup (enc);
+}
+
+const char *
+dict_get_encoding (const struct dictionary *d)
+{
+ return d->encoding ;
+}
+
+
void
dict_set_change_callback (struct dictionary *d,
void (*changed) (struct dictionary *, void*),
void
dict_set_change_callback (struct dictionary *d,
void (*changed) (struct dictionary *, void*),
@@
-194,6
+211,9
@@
dict_clone (const struct dictionary *s)
for (i = 0; i < s->vector_cnt; i++)
d->vector[i] = vector_clone (s->vector[i], s, d);
for (i = 0; i < s->vector_cnt; i++)
d->vector[i] = vector_clone (s->vector[i], s, d);
+ if ( s->encoding)
+ d->encoding = strdup (s->encoding);
+
dict_set_attributes (d, dict_get_attributes (s));
return d;
dict_set_attributes (d, dict_get_attributes (s));
return d;