Use anonymous struct/enum in typedefs where possible #4049
Use anonymous struct/enum in typedefs where possible #4049nrwahl2 wants to merge 20 commits intoClusterLabs:mainfrom
Conversation
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
There's no reason to name the structs or enums in these cases, since we always refer to the type using its typedef name. This commit skips changing public headers, since that would be an API change. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
The structure itself is not deprecated. However, we want to treat the struct in the typedef as anonymous and use cib_api_operations_t instead. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
clumens
left a comment
There was a problem hiding this comment.
It would also be worth adding something to doc/sphinx/Pacemaker_Development/c.rst explaining this. I'm hoping one day we'll have someone new on the team and we can point them at that instead of having to re-explain all this stuff.
|
|
||
| typedef void (*lrmd_event_callback) (lrmd_event_data_t * event); | ||
|
|
||
| //! \deprecated Use \c lrmd_list_t instead of <tt>struct lrmd_list_s</tt> |
There was a problem hiding this comment.
I would love to deprecate this all the way out of the code. It's so obnoxious to have a reimplementation of a linked list as public API.
There was a problem hiding this comment.
Agreed. That would be quite a bit more involved to do right now though. We have not only lrmd_list_freeall() using it but also three methods in lrmd_api_operations_t, which is not deprecated. Those method signatures can't be changed, so we'd have to get to a point where we can deprecate them altogether.
| @@ -184,6 +184,7 @@ typedef struct stonith_history_s { | |||
| } stonith_history_t; | |||
There was a problem hiding this comment.
Is there a reason we can't also deprecate stonith_history_s and stonith_key_value_s? (Speaking of things I'd love to see go away)
There was a problem hiding this comment.
Yep! The reason is they're already deprecated.
/*!
* \brief Key-value pair list node
* \deprecated Do not use
*/
typedef struct stonith_key_value_s {
char *key;
char *value;
struct stonith_key_value_s *next;
} stonith_key_value_t;
// @TODO Keep this definition but make it internal
/*!
* \brief Fencing history entry
* \deprecated Do not use
*/
typedef struct stonith_history_s {
char *target;
char *action;
char *origin;
char *delegate;
char *client;
int state;
time_t completed;
struct stonith_history_s *next;
long completed_nsec;
char *exit_reason;
} stonith_history_t;
The enum itself is not deprecated. However, we want to treat the enum in the typedef as anonymous and use crm_exit_t instead. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
The structure itself is not deprecated. However, we want to treat the struct in the typedef as anonymous and use crm_time_period_t instead. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
The structure itself is not deprecated. However, we want to treat the struct in the typedef as anonymous and use pcmk_nvpair_t instead. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
The structure itself is not deprecated. However, we want to treat the struct in the typedef as anonymous and use pcmk_rule_input_t instead. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
The structure itself is not deprecated. However, we want to treat the struct in the typedef as anonymous and use svc_action_t instead. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
The structure itself is not deprecated. However, we want to treat the struct in the typedef as anonymous and use lrmd_event_data_t instead. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
The structure itself is not deprecated. However, we want to treat the struct in the typedef as anonymous and use lrmd_key_value_t instead. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
The structure itself is not deprecated. However, we want to treat the struct in the typedef as anonymous and use lrmd_rsc_info_t instead. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
The structure itself is not deprecated. However, we want to treat the struct in the typedef as anonymous and use lrmd_op_info_t instead. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
The structure itself is not deprecated. However, we want to treat the struct in the typedef as anonymous and use lrmd_list_t instead. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
The structure itself is not deprecated. However, we want to treat the struct in the typedef as anonymous and use lrmd_api_operations_t instead. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Use appropriate libpacemaker functions instead. All public functions that use stonith_t are already deprecated. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
The structure itself is not deprecated. However, we want to use cib_t to refer to it instead. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
The structure itself is not deprecated. However, we want to use crm_time_t to refer to it instead. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
The structure itself is not deprecated. However, we want to use lrmd_t to refer to it instead. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
The development guide already says enums shouldn't have a typedef at all, and that they don't require any special naming convention. So really we should have I'll add a note for structs. |
55f5c68 to
a76be8f
Compare
Very low priority, but should be a quick review