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)
- Do we need to handle <stddef.h> specially? HOT 1
- conditional format strings broken in 2024-04-25 HOT 8
- Duplicate gpg keys in key selection menu for message encryption HOT 18
- segfault while opening a mailbox in from the sidebar HOT 2
- Doubts about paranoic defensive programming style HOT 3
- C dialect HOT 2
- tag-prefix doesn't show-up in attach HOT 5
- How to use the notmuch command <modify-labels> to tag emails with tags containing spaces?
- Is it possible to edit the automatic title when forwarding or replying a message? HOT 1
- Progress for postponing a message with remote (IMAP)
- autocrypt breaks command line argument `-e "push foo"` HOT 4
- How to forward an email thread to someone else together with attachments ? HOT 3
- `delete-thread` does not support `tag-prefix` operator
- split outgoing email into batches to work around max number of recipients limit in some SMTP providers (infomaniak) HOT 3
- save-message from GMail over IMAP to local box doesn't delete original HOT 3
- Cannot open an .mbox file with neomutt (although it works with mutt) HOT 4
- neomutt truecolor and kitty
- neomutt does not replace `...` by encrypted subject
- Inline-PGP with junk before recognized incorrectly
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.