- int offsets[MAX_ENTRY_SIZE / 2], useoffsets[MAX_USES];
- int i, n;
- TERMTYPE *tp = &(ep->tterm);
+ int offsets[MAX_ENTRY_SIZE / sizeof(short)];
+ int useoffsets[MAX_USES];
+ unsigned i, n;
+ unsigned nuses = ep->nuses;
+ TERMTYPE2 *tp = &(ep->tterm);
+
+ if (copy_strings) {
+ next_free = 0; /* clear static storage */
+
+ /* copy term_names, Strings, uses */
+ tp->term_names = _nc_save_str(tp->term_names);
+ for_each_string(i, tp) {
+ if (tp->Strings[i] != ABSENT_STRING &&
+ tp->Strings[i] != CANCELLED_STRING) {
+ tp->Strings[i] = _nc_save_str(tp->Strings[i]);
+ }
+ }
+
+ for (i = 0; i < nuses; i++) {
+ if (ep->uses[i].name == 0) {
+ ep->uses[i].name = _nc_save_str(ep->uses[i].name);
+ }
+ }
+
+ free(tp->str_table);
+ }