diff options
author | Colin Walters <walters@verbum.org> | 2017-05-31 14:48:53 -0400 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2017-05-31 14:56:04 -0400 |
commit | f5ba01cf65309164adb06067b39cf28c071e1ccb (patch) | |
tree | 72d50c5a6df3f4a10ea371c39269c8772f1ef436 /glnx-dirfd.h | |
parent | 66d162873c6f23d4628af80aa1f46fdf2d9e5e07 (diff) | |
download | libglnx-f5ba01cf65309164adb06067b39cf28c071e1ccb.tar.gz |
dirfd: Have dfd iter _take_fd() take a pointer and do a steal
This avoids callers having to use `glnx_steal_fd()` on their own; in general, I
think we should implement move semantics like this at the callee level.
Another reason to do this is there's a subtle problem with doing:
```
somefunction (steal_value (&v), ..., error);
```
in that if `somefunction` throws, it may not have taken ownership of the value.
At least `glnx_dirfd_iterator_init_take_fd()` didn't.
Diffstat (limited to 'glnx-dirfd.h')
-rw-r--r-- | glnx-dirfd.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/glnx-dirfd.h b/glnx-dirfd.h index 0cb79e6..581b303 100644 --- a/glnx-dirfd.h +++ b/glnx-dirfd.h @@ -55,7 +55,7 @@ typedef struct GLnxDirFdIterator GLnxDirFdIterator; gboolean glnx_dirfd_iterator_init_at (int dfd, const char *path, gboolean follow, GLnxDirFdIterator *dfd_iter, GError **error); -gboolean glnx_dirfd_iterator_init_take_fd (int dfd, GLnxDirFdIterator *dfd_iter, GError **error); +gboolean glnx_dirfd_iterator_init_take_fd (int *dfd, GLnxDirFdIterator *dfd_iter, GError **error); gboolean glnx_dirfd_iterator_next_dent (GLnxDirFdIterator *dfd_iter, struct dirent **out_dent, GCancellable *cancellable, |