]> granicus.if.org Git - neomutt/commitdiff
drop unnecessary FGETCONV typedef
authorRichard Russon <rich@flatcap.org>
Sat, 23 Dec 2017 02:10:47 +0000 (02:10 +0000)
committerRichard Russon <rich@flatcap.org>
Thu, 28 Dec 2017 13:25:19 +0000 (13:25 +0000)
mutt/charset.c
mutt/charset.h
mutt_charset.c
mutt_charset.h
ncrypt/crypt_gpgme.c
ncrypt/pgp.c
sendlib.c

index ecc390fbd540e9760755242475aece89fc735e43..d5d58a0ff2cd3bfed48c8b58bc5d31375e8beaaa 100644 (file)
@@ -227,18 +227,16 @@ const struct MimeNames PreferredMIMENames[] =
  * mutt_cs_fgetconv_close - Close an fgetconv handle
  * @param handle fgetconv handle
  */
-void mutt_cs_fgetconv_close(FGETCONV **handle)
+void mutt_cs_fgetconv_close(struct FgetConv **fc)
 {
-  struct FgetConv *fc = (struct FgetConv *) *handle;
-
-  if (fc->cd != (iconv_t) -1)
-    iconv_close(fc->cd);
-  FREE(handle);
+  if ((*fc)->cd != (iconv_t) -1)
+    iconv_close((*fc)->cd);
+  FREE(fc);
 }
 
 /**
  * mutt_cs_fgetconv - Convert a file's character set
- * @param handle fgetconv handle
+ * @param fc FgetConv handle
  * @retval num Next character in the converted file
  * @retval EOF Error
  *
@@ -246,10 +244,8 @@ void mutt_cs_fgetconv_close(FGETCONV **handle)
  * Each call to this function will return one converted character.
  * The buffer is refilled automatically when empty.
  */
-int mutt_cs_fgetconv(FGETCONV *handle)
+int mutt_cs_fgetconv(struct FgetConv *fc)
 {
-  struct FgetConv *fc = (struct FgetConv *) handle;
-
   if (!fc)
     return EOF;
   if (fc->cd == (iconv_t) -1)
@@ -300,22 +296,22 @@ int mutt_cs_fgetconv(FGETCONV *handle)
 
 /**
  * mutt_cs_fgetconvs - Convert a file's charset into a string buffer
- * @param buf    Buffer for result
- * @param l      Length of buffer
- * @param handle fgetconv handle
+ * @param buf Buffer for result
+ * @param l   Length of buffer
+ * @param fc  FgetConv handle
  * @retval ptr  Result buffer on success
  * @retval NULL Error
  *
  * Read a file into a buffer, converting the character set as it goes.
  */
-char *mutt_cs_fgetconvs(char *buf, size_t l, FGETCONV *handle)
+char *mutt_cs_fgetconvs(char *buf, size_t l, struct FgetConv *fc)
 {
   int c;
   size_t r;
 
   for (r = 0; r + 1 < l;)
   {
-    c = mutt_cs_fgetconv(handle);
+    c = mutt_cs_fgetconv(fc);
     if (c == EOF)
       break;
     buf[r++] = (char) c;
index 449d28c9c6383ef68e26d2dd3b88b687836545a2..ac17bf19f73c43c7a612a76c9a5814f3afb99736 100644 (file)
 extern char *AssumedCharset;
 extern char *Charset;
 
-typedef void *FGETCONV;
-
 /**
- * struct EgetConv - Cursor for converting a file's encoding
+ * struct FgetConv - Cursor for converting a file's encoding
  */
 struct FgetConv
 {
@@ -69,9 +67,9 @@ extern const struct MimeNames PreferredMIMENames[];
 
 void   mutt_cs_canonical_charset(char *dest, size_t dlen, const char *name);
 int    mutt_cs_chscmp(const char *s, const char *chs);
-void   mutt_cs_fgetconv_close(FGETCONV **handle);
-int    mutt_cs_fgetconv(FGETCONV *handle);
-char * mutt_cs_fgetconvs(char *buf, size_t l, FGETCONV *handle);
+void   mutt_cs_fgetconv_close(struct FgetConv **fc);
+int    mutt_cs_fgetconv(struct FgetConv *fc);
+char * mutt_cs_fgetconvs(char *buf, size_t l, struct FgetConv *fc);
 char * mutt_cs_get_default_charset(void);
 size_t mutt_cs_iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft, const char **inrepls, const char *outrepl);
 void   mutt_cs_set_langinfo_charset(void);
index f783a6366908abe8c05fbc876f6e38aa4bbc4a2a..366d7e485a86046186a7225293fe2bb09b7db788 100644 (file)
@@ -142,7 +142,7 @@ int mutt_convert_string(char **ps, const char *from, const char *to, int flags)
  *
  * Parameter flags is given as-is to mutt_iconv_open().
  */
-FGETCONV *fgetconv_open(FILE *file, const char *from, const char *to, int flags)
+struct FgetConv *fgetconv_open(FILE *file, const char *from, const char *to, int flags)
 {
   struct FgetConv *fc = NULL;
   iconv_t cd = (iconv_t) -1;
@@ -163,7 +163,7 @@ FGETCONV *fgetconv_open(FILE *file, const char *from, const char *to, int flags)
     fc = mutt_mem_malloc(sizeof(struct FgetConvNot));
   fc->file = file;
   fc->cd = cd;
-  return (FGETCONV *) fc;
+  return fc;
 }
 
 bool mutt_check_charset(const char *s, bool strict)
index 72d1742d3d8678dcfacd229918973dbbabda1086..a70efdbd98fc98e49927f22a74b5f06cb69513b7 100644 (file)
@@ -30,7 +30,7 @@
 int mutt_convert_string(char **ps, const char *from, const char *to, int flags);
 
 iconv_t mutt_iconv_open(const char *tocode, const char *fromcode, int flags);
-FGETCONV *fgetconv_open(FILE *file, const char *from, const char *to, int flags);
+struct FgetConv *fgetconv_open(FILE *file, const char *from, const char *to, int flags);
 
 /* flags for charset.c:mutt_convert_string(), fgetconv_open(), and
  * mutt_iconv_open(). Note that applying charset-hooks to tocode is
index da9d01277b1a6a3a1c36cca01019306638aecb6f..efd08f8e5f922a8dcffc622bb2ef3fb7797fddf1 100644 (file)
@@ -2436,7 +2436,7 @@ static void copy_clearsigned(gpgme_data_t data, struct State *s, char *charset)
 {
   char buf[HUGE_STRING];
   bool complete, armor_header;
-  FGETCONV *fc = NULL;
+  struct FgetConv *fc = NULL;
   char *fname = NULL;
   FILE *fp = NULL;
 
@@ -2675,7 +2675,7 @@ int pgp_gpgme_application_handler(struct Body *m, struct State *s)
       }
       else if (pgpout)
       {
-        FGETCONV *fc = NULL;
+        struct FgetConv *fc = NULL;
         int c;
         rewind(pgpout);
         fc = fgetconv_open(pgpout, "utf-8", Charset, 0);
index 7d2badf75660a915bf73d28f628f98afca46b675..d9adcd9d936ef9a092a0c6b6950d543d79f25bf5 100644 (file)
@@ -279,7 +279,7 @@ static void pgp_copy_clearsigned(FILE *fpin, struct State *s, char *charset)
   char buf[HUGE_STRING];
   bool complete, armor_header;
 
-  FGETCONV *fc = NULL;
+  struct FgetConv *fc = NULL;
 
   rewind(fpin);
 
@@ -541,7 +541,7 @@ int pgp_application_pgp_handler(struct Body *m, struct State *s)
       }
       else if (pgpout)
       {
-        FGETCONV *fc = NULL;
+        struct FgetConv *fc = NULL;
         int ch;
         char *expected_charset =
             gpgcharset && *gpgcharset ? gpgcharset : "utf-8";
@@ -1547,7 +1547,7 @@ struct Body *pgp_traditional_encryptsign(struct Body *a, int flags, char *keylis
   if (!mutt_cs_is_us_ascii(body_charset))
   {
     int c;
-    FGETCONV *fc = NULL;
+    struct FgetConv *fc = NULL;
 
     if (flags & ENCRYPT)
       send_charset = "us-ascii";
index e1eed0a6771531d8f443db83fe3d3b0ce6feed24..14cc257acc156c104f43050d24b2a19d49719d14 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -85,7 +85,7 @@
 
 const char MimeSpecials[] = "@.,;:<>[]\\\"()?/= \t";
 
-static void encode_quoted(FGETCONV *fc, FILE *fout, int istext)
+static void encode_quoted(struct FgetConv *fc, FILE *fout, int istext)
 {
   int c, linelen = 0;
   char line[77], savechar;
@@ -272,7 +272,7 @@ static void b64_putc(struct B64Context *ctx, char c, FILE *fout)
   ctx->buffer[ctx->size++] = c;
 }
 
-static void encode_base64(FGETCONV *fc, FILE *fout, int istext)
+static void encode_base64(struct FgetConv *fc, FILE *fout, int istext)
 {
   struct B64Context ctx;
   int ch, ch1 = EOF;
@@ -295,7 +295,7 @@ static void encode_base64(FGETCONV *fc, FILE *fout, int istext)
   fputc('\n', fout);
 }
 
-static void encode_8bit(FGETCONV *fc, FILE *fout)
+static void encode_8bit(struct FgetConv *fc, FILE *fout)
 {
   int ch;
 
@@ -431,7 +431,7 @@ int mutt_write_mime_body(struct Body *a, FILE *f)
   char *p, boundary[SHORT_STRING];
   char send_charset[SHORT_STRING];
   FILE *fpin = NULL;
-  FGETCONV *fc = NULL;
+  struct FgetConv *fc = NULL;
 
   if (a->type == TYPEMULTIPART)
   {