Comments (5)
The idea of b5640bb was to ensure that the subject
and real_subj
are kept in sync.
The const
is a hint to call mutt_env_set_subject()
rather than altering them directly.
from neomutt.
FTR the fields are const, not the pointers; don't cast the const away, use the setter
from neomutt.
FTR the fields are const, not the pointers;
I'm not sure what you mean by this. char *const p
means "p is a constant pointer to char", so the pointer is const.
Maybe you meant the the pointees aren't const, which I agree.
don't cast the const away, use the setter
Except that I count 10 casts outside of the setter. I'm not sure if something that requires adding 10 casts (+ the ones in the setter) is an improvement. Casts are the thing that hides most bugs by far, since they disable almost all compiler warnings.
from neomutt.
as far as i can tell, there's const-casts on both in the setter, merger, and deserialiser, all three of which are Envelope's member functions (or, as close as they can be), and entirely within the scope of the functions that should bypass the const.
there's an outlier in rfc2047_{de,de}code_envelope(struct Envelope *env)
, which juggles subject
to conform to unfortunate memory management requirements and then calls the setter. also a member (or, sure, friend), also fine.
not sure where you're getting "cast away all the time" here, this reads to me as being perfectly as-designed (only Envelope members (and friends) are allowed to edit these directly) and as-desired (the shit works so everyone else is forced to use the setters so IMAP works)
from neomutt.
as far as i can tell, there's const-casts on both in the setter, merger, and deserialiser, all three of which are Envelope's member functions (or, as close as they can be), and entirely within the scope of the functions that should bypass the const.
there's an outlier in
rfc2047_{de,de}code_envelope(struct Envelope *env)
, which jugglessubject
to conform to unfortunate memory management requirements and then calls the setter. also a member (or, sure, friend), also fine.
Hmmm, okay.
not sure where you're getting "cast away all the time" here,
Just a way of speaking.
It's not all the time, but a non-trivial amount: 7/52
$ grep -rn 'real_subj\>' | pee 'wc -l > /dev/tty' 'cat' | grep '(char' | wc -l
52
7
this reads to me as being perfectly as-designed (only Envelope members (and friends) are allowed to edit these directly) and as-desired
Yup; just that the design implies some slightly dangerous stuff, IMHO. But I guess since it's your design, it's your prerogative.
(the shit works so everyone else is forced to use the setters so IMAP works)
I would have probably just not forced anything, and just document that the setters should be used. But I know that you prefer C++, so I guess, it's all right. At least now I understand why it's *const
+ casts.
And FTR, I would just remove IMAP from neomutt(1), but that' not going to happen. It would certainly simplify it a lot. :)
Thanks for explaining!
from neomutt.
Related Issues (20)
- Toggle `pager_index_lines` HOT 3
- System tray HOT 7
- Timezone broken in index-format-hook display HOT 3
- `<entire-thread>` with `set nm_query_type = threads` does not preserve selected message
- Behavior with unparsable values of the "Expires" header HOT 4
- Current stable of BerkeleyDB apparently not supported "ouf-of-the-box" HOT 6
- `<tag-thread>` + `<save-message>` skips a thread instead of going to the next one HOT 13
- `test_url_parse` fails without `--pcre2` option to `./configure` HOT 7
- mail list retrive slow HOT 5
- bug fix in release 2022-04-15 breaks transparency/terminal background highlighting. HOT 4
- Hex colours in vim highlighted as comments HOT 1
- `=Y`, `~Y` should match individual keywords, not the space-separated list of keywords HOT 9
- Forwarding mail from the pager -> selecting aliased recipient from adressbook -> pager disappears (or empty pager) HOT 1
- Multiple problems HOT 1
- INBOX-first is broken for children of INBOX
- oauth token is too big HOT 4
- core dump when try to forward jpg attachment HOT 22
- Are attachment Content IDs modified by Neomutt or Gmail
- Neomutt freezes when `pager_format` incorrectly ends with `%>` HOT 1
- Is it possible to independently compose the body of an email using the Reply function?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from neomutt.