mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
coding-style: Don't encourage virXXXPtr typedefs
We don't like virXXXPtr typedefs really and they are going away shortly, possibly. Do not encourage new code to put in the typedefs. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
53454b7b34
commit
9ccbed6afb
@ -53,13 +53,10 @@ Struct type names
|
|||||||
All structs should have a 'vir' prefix in their typedef name,
|
All structs should have a 'vir' prefix in their typedef name,
|
||||||
and each following word should have its first letter in
|
and each following word should have its first letter in
|
||||||
uppercase. The struct name should be the same as the typedef
|
uppercase. The struct name should be the same as the typedef
|
||||||
name with a leading underscore. A second typedef should be
|
name with a leading underscore.
|
||||||
given for a pointer to the struct with a 'Ptr' suffix.
|
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
typedef struct _virHashTable virHashTable;
|
typedef struct _virHashTable virHashTable;
|
||||||
typedef virHashTable *virHashTablePtr;
|
|
||||||
struct _virHashTable {
|
struct _virHashTable {
|
||||||
...
|
...
|
||||||
};
|
};
|
||||||
@ -426,11 +423,11 @@ Conditional expressions
|
|||||||
|
|
||||||
For readability reasons new code should avoid shortening
|
For readability reasons new code should avoid shortening
|
||||||
comparisons to 0 for numeric types. Boolean and pointer
|
comparisons to 0 for numeric types. Boolean and pointer
|
||||||
comparisions may be shortened. All long forms are okay:
|
comparisons may be shortened. All long forms are okay:
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
virFooPtr foos = NULL;
|
virFoo *foos = NULL;
|
||||||
size nfoos = 0;
|
size nfoos = 0;
|
||||||
bool hasFoos = false;
|
bool hasFoos = false;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user