summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReuben Thomas <rrt@sc3d.org>2020-09-01 16:34:15 +0100
committerReuben Thomas <rrt@sc3d.org>2020-09-01 16:34:15 +0100
commit13129240dec18f43b30f4e090d43bf1e5471b7a9 (patch)
treee1d162cf02715e98c8cd7fc3f6da36a5a462f5ce
parent15d40fbe132095793a34426e038c1291e05a4454 (diff)
downloadenchant-13129240dec18f43b30f4e090d43bf1e5471b7a9.tar.gz
enchant.c: some slight tidy-up
-rw-r--r--src/enchant.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/enchant.c b/src/enchant.c
index bf00d8a..579b6a0 100644
--- a/src/enchant.c
+++ b/src/enchant.c
@@ -1,7 +1,7 @@
/* enchant
* Copyright (C) 2003 Dom Lachowicz
* 2007 Hannu Väisänen
- * 2016-2017 Reuben Thomas
+ * 2016-2020 Reuben Thomas
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -135,9 +135,6 @@ print_utf (const char * str)
static void
do_mode_a (EnchantDict * dict, GString * word, size_t start_pos, size_t lineCount, gboolean terse_mode)
{
- size_t n_suggs;
- char ** suggs;
-
if (word->len <= MIN_WORD_LENGTH || enchant_dict_check (dict, word->str, word->len) == 0) {
if (!terse_mode) {
if (lineCount)
@@ -145,27 +142,23 @@ do_mode_a (EnchantDict * dict, GString * word, size_t start_pos, size_t lineCoun
else
printf ("*\n");
}
- }
- else {
- suggs = enchant_dict_suggest (dict, word->str,
- word->len, &n_suggs);
+ } else {
+ size_t n_suggs;
+ char ** suggs = enchant_dict_suggest (dict, word->str, word->len, &n_suggs);
if (!n_suggs || !suggs) {
printf ("# ");
if (lineCount)
printf ("%u ", (unsigned int)lineCount);
print_utf (word->str);
printf (" %u\n", (unsigned int)start_pos);
- }
- else {
- size_t i = 0;
-
+ } else {
printf ("& ");
if (lineCount)
printf ("%u ", (unsigned int)lineCount);
print_utf (word->str);
printf (" %u %u:", (unsigned int)n_suggs, (unsigned int)start_pos);
- for (i = 0; i < n_suggs; i++) {
+ for (size_t i = 0; i < n_suggs; i++) {
putchar (' ');
print_utf (suggs[i]);