-/* m2spellcheck.cc provides an interface to GCC expression trees.
+/* m2spellcheck.cc provides an interface to the GCC spell checker.
Copyright (C) 2025 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaiusmod2@gmail.com>.
/* Define the hidden type Candidates declared in the definition module. */
+typedef auto_vec<const char *> candidates_array_vec_t;
typedef struct Candidates_t {
- auto_vec<const char *> candidates_array;
+ candidates_array_vec_t candidates_array;
struct Candidates_t *next;
} Candidates;
c = freeList;
freeList = freeList->next;
}
- memset (c, 0, sizeof (Candidates));
+ :: new (&c->candidates_array) auto_vec<const char *> ();
+ c->next = NULL;
return c;
}
/* Push a string to the Candidates array.
- The candidates array will contain str at the end. */
+ The candidates array will contain the string name at the end. */
static
void
Push (static_cast<Candidates *> (cand), name);
}
+/* Return the Candidates structure to the freeList and deallocate
+ the auto_vec candidates_array. */
+
static
void
KillCandidates (Candidates **cand)
{
- // --fixme-- deallocate and zero the candidates_array.
(*cand)->next = freeList;
+ (*cand)->candidates_array.~candidates_array_vec_t ();
freeList = *cand;
(*cand) = NULL;
}