mirror of
https://github.com/flatpak/flatpak.git
synced 2026-04-16 13:00:48 -04:00
Generate peek() versions for arrays/dicts
This commit is contained in:
@@ -811,6 +811,14 @@ class ArrayType(Type):
|
||||
C(" return ({ElementTypenameRef}) {{ ((const char *)v.base) + start, end - start }};")
|
||||
C("}}")
|
||||
|
||||
if self.is_fixed():
|
||||
C("""
|
||||
static inline const {element_fixed_type} *
|
||||
{type_name_}peek ({TypeNameRef} v) {{
|
||||
return (const {element_fixed_type} *)v.base;
|
||||
}}
|
||||
""");
|
||||
|
||||
C(
|
||||
"""static inline GString *
|
||||
{type_name_}format ({TypeNameRef} v, GString *s, gboolean type_annotate)
|
||||
@@ -955,6 +963,15 @@ typedef struct {{
|
||||
|
||||
C('')
|
||||
|
||||
if self.element_is_fixed():
|
||||
C("""
|
||||
static inline const {TypeName}Entry *
|
||||
{type_name_}peek ({TypeNameRef} v) {{
|
||||
return (const {TypeName}Entry *)v.base;
|
||||
}}
|
||||
""");
|
||||
|
||||
|
||||
C("static inline {key_ctype}")
|
||||
C("{type_name_}entry_get_key ({TypeName}EntryRef v)")
|
||||
C("{{")
|
||||
|
||||
Reference in New Issue
Block a user