#define GETWCHAR(W,L,N,T) ( ((const uint8*)(W))[ ((T)==FF_PREFIX) ? (N) : ( (L) - 1 - (N) ) ] )
#define GETCHAR(A,N,T) GETWCHAR( (A)->repl, (A)->replen, N, T )
-static char *VoidString = "";
+static const char *VoidString = "";
static int
cmpspell(const void *s1, const void *s2)
* sflag: returns an affix flag from sflagset.
*/
static void
-getNextFlagFromString(IspellDict *Conf, char **sflagset, char *sflag)
+getNextFlagFromString(IspellDict *Conf, const char **sflagset, char *sflag)
{
int32 s;
- char *next,
- *sbuf = *sflagset;
+ char *next;
+ const char *sbuf = *sflagset;
int maxstep;
bool stop = false;
bool met_comma = false;
static bool
IsAffixFlagInUse(IspellDict *Conf, int affix, const char *affixflag)
{
- char *flagcur;
+ const char *flagcur;
char flag[BUFSIZ];
if (*affixflag == 0)
* flags s.
*/
static int
-getCompoundAffixFlagValue(IspellDict *Conf, char *s)
+getCompoundAffixFlagValue(IspellDict *Conf, const char *s)
{
uint32 flag = 0;
CompoundAffixFlag *found,
key;
char sflag[BUFSIZ];
- char *flagcur;
+ const char *flagcur;
if (Conf->nCompoundAffixFlag == 0)
return 0;
* Conf->AffixData array and function returns its entry.
* Else function returns the s parameter.
*/
-static char *
+static const char *
getAffixFlagSet(IspellDict *Conf, char *s)
{
if (Conf->useFlagAliases && *s != '\0')
/* Also reserve place for empty flag set */
naffix++;
- Conf->AffixData = (char **) palloc0(naffix * sizeof(char *));
+ Conf->AffixData = (const char **) palloc0(naffix * sizeof(char *));
Conf->lenAffixData = Conf->nAffixData = naffix;
/* Add empty flag set into AffixData */
static int
MergeAffix(IspellDict *Conf, int a1, int a2)
{
- char **ptr;
+ const char **ptr;
Assert(a1 < Conf->nAffixData && a2 < Conf->nAffixData);
if (Conf->nAffixData + 1 >= Conf->lenAffixData)
{
Conf->lenAffixData *= 2;
- Conf->AffixData = (char **) repalloc(Conf->AffixData,
- sizeof(char *) * Conf->lenAffixData);
+ Conf->AffixData = (const char **) repalloc(Conf->AffixData,
+ sizeof(char *) * Conf->lenAffixData);
}
ptr = Conf->AffixData + Conf->nAffixData;
if (Conf->flagMode == FM_NUM)
{
- *ptr = cpalloc(strlen(Conf->AffixData[a1]) +
- strlen(Conf->AffixData[a2]) +
- 1 /* comma */ + 1 /* \0 */ );
- sprintf(*ptr, "%s,%s", Conf->AffixData[a1], Conf->AffixData[a2]);
+ char *p = cpalloc(strlen(Conf->AffixData[a1]) +
+ strlen(Conf->AffixData[a2]) +
+ 1 /* comma */ + 1 /* \0 */ );
+
+ sprintf(p, "%s,%s", Conf->AffixData[a1], Conf->AffixData[a2]);
+ *ptr = p;
}
else
{
- *ptr = cpalloc(strlen(Conf->AffixData[a1]) +
- strlen(Conf->AffixData[a2]) +
- 1 /* \0 */ );
- sprintf(*ptr, "%s%s", Conf->AffixData[a1], Conf->AffixData[a2]);
+ char *p = cpalloc(strlen(Conf->AffixData[a1]) +
+ strlen(Conf->AffixData[a2]) +
+ 1 /* \0 */ );
+
+ sprintf(p, "%s%s", Conf->AffixData[a1], Conf->AffixData[a2]);
+ *ptr = p;
}
ptr++;
*ptr = NULL;
* dictionary. Replace textual flag-field of Conf->Spell entries with
* indexes into Conf->AffixData array.
*/
- Conf->AffixData = (char **) palloc0(naffix * sizeof(char *));
+ Conf->AffixData = (const char **) palloc0(naffix * sizeof(const char *));
curaffix = -1;
for (i = 0; i < Conf->nspell; i++)
* returns false.
*/
static bool
-isAffixInUse(IspellDict *Conf, char *affixflag)
+isAffixInUse(IspellDict *Conf, const char *affixflag)
{
int i;
}
static char **
-NormalizeSubWord(IspellDict *Conf, char *word, int flag)
+NormalizeSubWord(IspellDict *Conf, const char *word, int flag)
{
AffixNodeData *suffix = NULL,
*prefix = NULL;
if (CheckAffix(newword, swrdlen, prefix->aff[j], flag, pnewword, &baselen))
{
/* prefix success */
- char *ff = (prefix->aff[j]->flagflags & suffix->aff[i]->flagflags & FF_CROSSPRODUCT) ?
+ const char *ff = (prefix->aff[j]->flagflags & suffix->aff[i]->flagflags & FF_CROSSPRODUCT) ?
VoidString : prefix->aff[j]->flag;
if (FindWord(Conf, pnewword, ff, flag))
} SplitVar;
static int
-CheckCompoundAffixes(CMPDAffix **ptr, char *word, int len, bool CheckInPlace)
+CheckCompoundAffixes(CMPDAffix **ptr, const char *word, int len, bool CheckInPlace)
{
bool issuffix;
}
static SplitVar *
-SplitToVariants(IspellDict *Conf, SPNode *snode, SplitVar *orig, char *word, int wordlen, int startpos, int minpos)
+SplitToVariants(IspellDict *Conf, SPNode *snode, SplitVar *orig, const char *word, int wordlen, int startpos, int minpos)
{
SplitVar *var = NULL;
SPNodeData *StopLow,
}
TSLexeme *
-NINormalizeWord(IspellDict *Conf, char *word)
+NINormalizeWord(IspellDict *Conf, const char *word)
{
char **res;
TSLexeme *lcur = NULL,