[neomutt-devel] Huge code changes

Richard Russon rich at flatcap.org
Thu May 18 14:55:53 CEST 2017


For those of you not following GitHub's notifications...
I've just made a load more (sort of) big changes to the code.

If you have any problems with the build, please let me know ASAP.

## Death of typedefs

Following a discussion (#381: https://github.com/neomutt/neomutt/issues/381)
it was decided that typedefs should only be used for opaque data types.

Furthermore, the names of the structs should be unified.
Here's a sample:

    Old typedef | New struct
    ------------|----------------
    POP_CACHE   | struct PopCache
    HASH        | struct Hash
    ENVELOPE    | struct Envelope
    smime_key_t | struct SmimeKey
    QUERY       | struct Query
    MIXCHAIN    | struct MixChain

## Split up mutt.h, protos.h

Many source files in mutt are HUGE.
Two of the worst offenders are mutt.h and protos.h

I've cut out 14 commonly used structs from mutt.h and put them in their
own header files.  I've also moved the associated functions from proto.h

- address.h      -- struct Address
- alias.h        -- struct Alias
- body.h         -- struct Body
- content.h      -- struct Content
- context.h      -- struct Context
- enter_state.h  -- struct EnterState
- envelope.h     -- struct Envelope
- format_flags.h -- enum MUTT_FORMAT used by mutt_FormatString
- header.h       -- struct Header
- list.h         -- struct List
- mbyte_table.h  -- struct MbCharTable
- options.h      -- enum of OPT*
- parameter.h    -- struct Parameter
- pattern.h      -- struct Pattern
- state.h        -- struct State
- thread.h       -- struct Thread
- where.h        -- evil macro

This makes it easier to see the dependencies in the code.

## Move crypto source to /ncrypt

I've moved all the crypto code into a new dir: /ncrypt
The name is slight odd to avoid clashes with other libraries.
Think of it as a merging 'encrypt' and 'neomutt crypt'.

The move of 29 source files isn't quite as clean as I'd like.
The interface between mutt and the crypto code is very strange.

There are four possible ways of using the code:
    with / without gpgme
    with pgp / with smime
but the code combines pgp and smime into one Frankenstein interface.

Also the main body of code is littered with references to crypto which
means we need to compile some of it, even if it's not wanted.

If anyone wants a difficult pure coding challenge, let me know.

## Rebasing

With all great refactoring changes comes the burden of rebasing all the
other branches.

If your code's in the neomutt repo, you get a free pass.
I will rebase your code (unless you wish to do it yourself).
(This may take a few days).

Rich / FlatCap
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://mailman.neomutt.org/pipermail/neomutt-devel-neomutt.org/attachments/20170518/686ba559/attachment.sig>


More information about the neomutt-devel mailing list