mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-13 12:50:33 +01:00
shared/strbuf: expose read only value for "allocated" buffer size
We cannot actually mark the field as const, because then you could no longer initialize a variable that contains a NMStrBuf with designated initializers. We also want to keep the "_allocated" alias, for the only places that are allowed to mutate the field: inside "nm-str-buf.h". Add an alias for that field, that is allowed to be read, provided that you don't modify it! The alternative would be a nm_str_buf_get_allocated() accessor, but that seems unnecessarily verbose when you could just access the field.
This commit is contained in:
parent
7ff170a28f
commit
64894182ca
1 changed files with 4 additions and 1 deletions
|
|
@ -16,7 +16,10 @@ typedef struct _NMStrBuf {
|
|||
/*const*/ gsize len;
|
||||
gsize _len;
|
||||
};
|
||||
gsize _allocated;
|
||||
union {
|
||||
/*const*/ gsize allocated;
|
||||
gsize _allocated;
|
||||
};
|
||||
bool _do_bzero_mem;
|
||||
} NMStrBuf;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue