girepository: Annotate C99 flexible arrays with their dynamic lengths

Using the new `G_COUNTED_BY` macro (i.e. the `__counted_by__`
attribute).

I found the declarations using:
```sh
git grep '\[\];' | grep -v '='
```

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
Philip Withnall 2024-02-29 13:43:02 +00:00
parent 9d23578318
commit e2340f111b
2 changed files with 7 additions and 7 deletions

View File

@ -78,7 +78,7 @@
typedef struct { typedef struct {
size_t n_interfaces; size_t n_interfaces;
GIBaseInfo *interfaces[]; GIBaseInfo *interfaces[] G_COUNTED_BY(n_interfaces);
} GTypeInterfaceCache; } GTypeInterfaceCache;
static void static void

View File

@ -549,7 +549,7 @@ typedef struct {
uint16_t n_arguments; uint16_t n_arguments;
ArgBlob arguments[]; ArgBlob arguments[] G_COUNTED_BY(n_arguments);
} SignatureBlob; } SignatureBlob;
/** /**
@ -743,7 +743,7 @@ typedef struct {
uint8_t reserved2; uint8_t reserved2;
uint16_t n_types; uint16_t n_types;
SimpleTypeBlob type[]; SimpleTypeBlob type[] G_COUNTED_BY(n_types);
} ParamTypeBlob; } ParamTypeBlob;
/** /**
@ -767,7 +767,7 @@ typedef struct {
uint8_t reserved2; uint8_t reserved2;
uint16_t n_domains; /* Must be 0 */ uint16_t n_domains; /* Must be 0 */
uint16_t domains[]; uint16_t domains[] G_COUNTED_BY(n_domains);
} ErrorTypeBlob; } ErrorTypeBlob;
/** /**
@ -989,7 +989,7 @@ typedef struct {
uint32_t error_domain; uint32_t error_domain;
ValueBlob values[]; ValueBlob values[] G_COUNTED_BY(n_values);
} EnumBlob; } EnumBlob;
#define ACCESSOR_SENTINEL 0x3ff #define ACCESSOR_SENTINEL 0x3ff
@ -1209,7 +1209,7 @@ typedef struct {
uint32_t reserved3; uint32_t reserved3;
uint32_t reserved4; uint32_t reserved4;
uint16_t interfaces[]; uint16_t interfaces[] G_COUNTED_BY(n_interfaces);
} ObjectBlob; } ObjectBlob;
/** /**
@ -1261,7 +1261,7 @@ typedef struct {
uint32_t reserved2; uint32_t reserved2;
uint32_t reserved3; uint32_t reserved3;
uint16_t prerequisites[]; uint16_t prerequisites[] G_COUNTED_BY(n_prerequisites);
} InterfaceBlob; } InterfaceBlob;
/** /**