rlimit-util: add a common destructor call for arrays of struct rlimit
This commit is contained in:
@@ -324,3 +324,13 @@ int rlimit_from_string_harder(const char *s) {
|
||||
|
||||
return rlimit_from_string(s);
|
||||
}
|
||||
|
||||
void rlimit_free_all(struct rlimit **rl) {
|
||||
int i;
|
||||
|
||||
if (!rl)
|
||||
return;
|
||||
|
||||
for (i = 0; i < _RLIMIT_MAX; i++)
|
||||
rl[i] = mfree(rl[i]);
|
||||
}
|
||||
|
||||
@@ -22,4 +22,6 @@ int rlimit_parse(int resource, const char *val, struct rlimit *ret);
|
||||
|
||||
int rlimit_format(const struct rlimit *rl, char **ret);
|
||||
|
||||
void rlimit_free_all(struct rlimit **rl);
|
||||
|
||||
#define RLIMIT_MAKE_CONST(lim) ((struct rlimit) { lim, lim })
|
||||
|
||||
Reference in New Issue
Block a user