rnp
rnp copied to clipboard
Explicitly initialize POD struct fields.
Description
As from discussion at https://github.com/rnpgp/rnp/pull/1109#issuecomment-624612517 we should {}
- initialize all struct fields to avoid possible further initialization errors.
maybe just
memset(&s, 0, sizeof some_struct_t);
?
maybe just
memset(&s, 0, sizeof some_struct_t);
?
It's not very C++-y, it relies on all members remaining POD, and it seems maybe more likely to be a runtime vs compile-time thing.
maybe just
memset(&s, 0, sizeof some_struct_t);
?
That will not work within the migration to C++, when, for instance, list variables will become a std::vector or std::map.
So, I'm going to replace calloc
with new
and free
with delete
, right?
for all these:
- rnp_ffi_st
- rnp_key_handle_st
- rnp_uid_handle_st
- rnp_signature_handle_st
- rnp_recipient_handle_st
- rnp_symenc_handle_st
- rnp_input_st
- rnp_output_st
- rnp_op_generate_st
- rnp_op_sign_st
- rnp_op_sign_signature_st
- rnp_op_verify_signature_st
- rnp_op_verify_st
- rnp_op_encrypt_st
- rnp_identifier_iterator_st
Please not yet, if possible - I have some postponed code which will definitely conflict with those changes (see https://github.com/ni4/rnp/pull/4)