Add a few annotations

Add a few pure, const and malloc annotations. These were suggested
by the gcc -Wsuggest-attribute option.
This commit is contained in:
Matthias Clasen 2023-12-26 21:55:59 -05:00
parent 6d57bbe7dd
commit 062902c003
7 changed files with 22 additions and 22 deletions

View File

@ -57,11 +57,11 @@ void gsk_path_point_free (GskPathPoint *poin
GDK_AVAILABLE_IN_4_14 GDK_AVAILABLE_IN_4_14
gboolean gsk_path_point_equal (const GskPathPoint *point1, gboolean gsk_path_point_equal (const GskPathPoint *point1,
const GskPathPoint *point2); const GskPathPoint *point2) G_GNUC_PURE;
GDK_AVAILABLE_IN_4_14 GDK_AVAILABLE_IN_4_14
int gsk_path_point_compare (const GskPathPoint *point1, int gsk_path_point_compare (const GskPathPoint *point1,
const GskPathPoint *point2); const GskPathPoint *point2) G_GNUC_PURE;
GDK_AVAILABLE_IN_4_14 GDK_AVAILABLE_IN_4_14
void gsk_path_point_get_position (const GskPathPoint *point, void gsk_path_point_get_position (const GskPathPoint *point,

View File

@ -87,8 +87,8 @@ void gsk_container_node_diff_with (GskRenderNode
void gsk_render_node_draw_fallback (GskRenderNode *node, void gsk_render_node_draw_fallback (GskRenderNode *node,
cairo_t *cr); cairo_t *cr);
bool gsk_border_node_get_uniform (const GskRenderNode *self); bool gsk_border_node_get_uniform (const GskRenderNode *self) G_GNUC_PURE;
bool gsk_border_node_get_uniform_color (const GskRenderNode *self); bool gsk_border_node_get_uniform_color (const GskRenderNode *self) G_GNUC_PURE;
void gsk_text_node_serialize_glyphs (GskRenderNode *self, void gsk_text_node_serialize_glyphs (GskRenderNode *self,
GString *str); GString *str);
@ -99,11 +99,11 @@ GskRenderNode ** gsk_container_node_get_children (const GskRenderNode
void gsk_transform_node_get_translate (const GskRenderNode *node, void gsk_transform_node_get_translate (const GskRenderNode *node,
float *dx, float *dx,
float *dy); float *dy);
GdkMemoryDepth gsk_render_node_get_preferred_depth (const GskRenderNode *node); GdkMemoryDepth gsk_render_node_get_preferred_depth (const GskRenderNode *node) G_GNUC_PURE;
gboolean gsk_container_node_is_disjoint (const GskRenderNode *node); gboolean gsk_container_node_is_disjoint (const GskRenderNode *node) G_GNUC_PURE;
gboolean gsk_render_node_use_offscreen_for_opacity (const GskRenderNode *node); gboolean gsk_render_node_use_offscreen_for_opacity (const GskRenderNode *node) G_GNUC_PURE;
#define gsk_render_node_ref(node) _gsk_render_node_ref(node) #define gsk_render_node_ref(node) _gsk_render_node_ref(node)
#define gsk_render_node_unref(node) _gsk_render_node_unref(node) #define gsk_render_node_unref(node) _gsk_render_node_unref(node)

View File

@ -87,9 +87,9 @@ typedef enum {
GTK_ACCESSIBLE_NAME_NOT_RECOMMENDED, GTK_ACCESSIBLE_NAME_NOT_RECOMMENDED,
} GtkAccessibleNaming; } GtkAccessibleNaming;
gboolean gtk_accessible_role_supports_name_from_author (GtkAccessibleRole role); gboolean gtk_accessible_role_supports_name_from_author (GtkAccessibleRole role) G_GNUC_CONST;
gboolean gtk_accessible_role_supports_name_from_content (GtkAccessibleRole role); gboolean gtk_accessible_role_supports_name_from_content (GtkAccessibleRole role) G_GNUC_CONST;
GtkAccessibleNaming gtk_accessible_role_get_naming (GtkAccessibleRole role); GtkAccessibleNaming gtk_accessible_role_get_naming (GtkAccessibleRole role) G_GNUC_CONST;
gboolean gtk_accessible_should_present (GtkAccessible *self); gboolean gtk_accessible_should_present (GtkAccessible *self);

View File

@ -21,7 +21,7 @@
G_BEGIN_DECLS G_BEGIN_DECLS
char *accessible_color_name (const GdkRGBA *color); char *accessible_color_name (const GdkRGBA *color) G_GNUC_MALLOC;
G_END_DECLS G_END_DECLS

View File

@ -95,7 +95,7 @@ gtk_css_value_array_equal (const GtkCssValue *value1,
return TRUE; return TRUE;
} }
static guint static inline guint
gcd (guint a, guint b) gcd (guint a, guint b)
{ {
while (b != 0) while (b != 0)
@ -107,7 +107,7 @@ gcd (guint a, guint b)
return a; return a;
} }
static guint static inline guint
lcm (guint a, guint b) lcm (guint a, guint b)
{ {
return a / gcd (a, b) * b; return a / gcd (a, b) * b;

View File

@ -21,7 +21,7 @@
G_BEGIN_DECLS G_BEGIN_DECLS
char *_gtk_get_theme_dir (void); char *_gtk_get_theme_dir (void) G_GNUC_MALLOC;
const char *_gtk_css_provider_get_theme_dir (GtkCssProvider *provider); const char *_gtk_css_provider_get_theme_dir (GtkCssProvider *provider);

View File

@ -54,11 +54,11 @@ G_BEGIN_DECLS
#define gtk_internal_return_val_if_fail(__expr, __val) g_return_val_if_fail(__expr, __val) #define gtk_internal_return_val_if_fail(__expr, __val) g_return_val_if_fail(__expr, __val)
#endif #endif
const char * _gtk_get_datadir (void); const char * _gtk_get_datadir (void) G_GNUC_CONST;
const char * _gtk_get_libdir (void); const char * _gtk_get_libdir (void) G_GNUC_CONST;
const char * _gtk_get_sysconfdir (void); const char * _gtk_get_sysconfdir (void) G_GNUC_CONST;
const char * _gtk_get_localedir (void); const char * _gtk_get_localedir (void) G_GNUC_CONST;
const char * _gtk_get_data_prefix (void); const char * _gtk_get_data_prefix (void) G_GNUC_CONST;
gboolean _gtk_fnmatch (const char *pattern, gboolean _gtk_fnmatch (const char *pattern,
const char *string, const char *string,
@ -68,7 +68,7 @@ gboolean _gtk_fnmatch (const char *pattern,
char * _gtk_make_ci_glob_pattern (const char *pattern); char * _gtk_make_ci_glob_pattern (const char *pattern);
char * _gtk_get_lc_ctype (void); char * _gtk_get_lc_ctype (void) G_GNUC_MALLOC;
void _gtk_ensure_resources (void); void _gtk_ensure_resources (void);
@ -106,9 +106,9 @@ double _gtk_get_slowdown (void);
void _gtk_set_slowdown (double slowdown_factor); void _gtk_set_slowdown (double slowdown_factor);
char *gtk_get_portal_request_path (GDBusConnection *connection, char *gtk_get_portal_request_path (GDBusConnection *connection,
char **token); char **token) G_GNUC_MALLOC;
char *gtk_get_portal_session_path (GDBusConnection *connection, char *gtk_get_portal_session_path (GDBusConnection *connection,
char **token); char **token) G_GNUC_MALLOC;
guint gtk_get_portal_interface_version (GDBusConnection *connection, guint gtk_get_portal_interface_version (GDBusConnection *connection,
const char *interface_name); const char *interface_name);