+ name_cache = (char **)tmp;
+ }
+ for (i = 0; i < name_cache_size; i++)
+ free(name_cache[i]);
+ for (i = 0; i < newsize; i++)
+ name_cache[i] = strdup(get_nlist_name(i));
+
+ name_cache_size = newsize;
+ qsort(name_cache, name_cache_size, sizeof(name_cache[0]),
+ name_cache_cmp);
+}
+
+static void my_rename(ea_t ea, char *name)
+{
+ char buf[256];
+ char *p, **pp;
+ int n = 0;
+
+ qsnprintf(buf, sizeof(buf), "%s", name);
+ do {
+ p = buf;
+ pp = (char **)bsearch(&p, name_cache, name_cache_size,
+ sizeof(name_cache[0]), name_cache_cmp);
+ if (pp == NULL)
+ break;
+
+ qsnprintf(buf, sizeof(buf), "%s_g%d", name, n);
+ n++;
+ }
+ while (n < 100);
+
+ if (n == 100)
+ msg("rename failure? '%s'\n", name);
+
+ do_name_anyway(ea, buf);
+ rebuild_name_cache();
+}
+
+static void make_align(ea_t ea)
+{
+ ea_t tmp_ea;
+ int n;
+
+ tmp_ea = next_head(ea, inf.maxEA);
+ if ((tmp_ea & 0x03) == 0) {
+ n = calc_max_align(tmp_ea);
+ if (n > 4) // masm doesn't like more..
+ n = 4;
+ msg("%x: align %d\n", ea, 1 << n);
+ do_unknown(ea, DOUNK_SIMPLE);
+ doAlign(ea, tmp_ea - ea, n);