aboutsummaryrefslogtreecommitdiff
path: root/src/librc/rc.h.in
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-03-31 08:27:42 +0100
committerWilliam Hubbs <w.d.hubbs@gmail.com>2022-05-08 14:56:26 -0500
commit7b2e8f9efd28566133b0da5ccf91b0e24a0d6c15 (patch)
treefbd03f747b1709cff63fa7edcdc557ec4f2a1c75 /src/librc/rc.h.in
parent000a2c19b43afb60559cbf63b71446f6c908505a (diff)
librc: mark rc_deptree_* functions as mallocs
(This is analogous to the rc_stringlist change.) This gives a hint to the compiler that allocations (return values) from this function should be paired with a corresponding dealloc/free function. Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'src/librc/rc.h.in')
-rw-r--r--src/librc/rc.h.in14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/librc/rc.h.in b/src/librc/rc.h.in
index 0727c12e..69d9d0e4 100644
--- a/src/librc/rc.h.in
+++ b/src/librc/rc.h.in
@@ -407,6 +407,10 @@ bool rc_older_than(const char *, const char *, time_t *, char *);
* @return pointer to the value, otherwise NULL */
char *rc_proc_getent(const char *);
+/*! Free a deptree and its information
+ * @param deptree to free */
+void rc_deptree_free(RC_DEPTREE *);
+
/*! Update the cached dependency tree if it's older than any init script,
* its configuration file or an external configuration file the init script
* has specified.
@@ -426,11 +430,17 @@ bool rc_deptree_update_needed(time_t *, char *);
/*! Load the cached dependency tree and return a pointer to it.
* This pointer should be freed with rc_deptree_free when done.
* @return pointer to the dependency tree */
+#ifdef HAVE_MALLOC_EXTENDED_ATTRIBUTE
+__attribute__ ((malloc (rc_deptree_free, 1)))
+#endif
RC_DEPTREE *rc_deptree_load(void);
/*! Load a cached dependency tree from the specified file and return a pointer
* to it. This pointer should be freed with rc_deptree_free when done.
* @return pointer to the dependency tree */
+#ifdef HAVE_MALLOC_EXTENDED_ATTRIBUTE
+__attribute__ ((malloc (rc_deptree_free, 1)))
+#endif
RC_DEPTREE *rc_deptree_load_file(const char *);
/*! List the depend for the type of service
@@ -459,10 +469,6 @@ RC_STRINGLIST *rc_deptree_depends(const RC_DEPTREE *, const RC_STRINGLIST *,
* @return NULL terminated list of services in order */
RC_STRINGLIST *rc_deptree_order(const RC_DEPTREE *, const char *, int);
-/*! Free a deptree and its information
- * @param deptree to free */
-void rc_deptree_free(RC_DEPTREE *);
-
/*! @name Plugins
* For each plugin loaded we will call rc_plugin_hook with the below
* enum and either the runlevel name or service name.