mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-29 16:10:11 +01:00
ifcfg: add nm_auto_shvar_file_close cleanup macro
This commit is contained in:
parent
7e79e913ad
commit
19c9d1bafd
1 changed files with 12 additions and 0 deletions
|
|
@ -87,4 +87,16 @@ void svCloseFile (shvarFile *s);
|
|||
const char *svEscape (const char *s, char **to_free);
|
||||
const char *svUnescape (const char *s, char **to_free);
|
||||
|
||||
static inline void
|
||||
_nm_auto_shvar_file_close (shvarFile **p_s)
|
||||
{
|
||||
if (*p_s) {
|
||||
int errsv = errno;
|
||||
|
||||
svCloseFile (*p_s);
|
||||
errno = errsv;
|
||||
}
|
||||
}
|
||||
#define nm_auto_shvar_file_close nm_auto(_nm_auto_shvar_file_close)
|
||||
|
||||
#endif /* _SHVAR_H */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue