[systemd-devel] [PATCH 1/4] sd-resolve: get rid of sd_resolve_freeanswer()

Tom Gundersen teg at jklm.no
Sat Jan 18 08:24:14 PST 2014


Hi Daniel,

Thanks a lot for the patches, they all look good. I'll push them out shortly.

Cheers,

Tom


On Sat, Jan 18, 2014 at 4:07 PM, Daniel Buch <boogiewasthere at gmail.com> wrote:
> ---
>  TODO                          |  1 -
>  src/libsystemd/resolve-util.h |  2 --
>  src/libsystemd/sd-resolve.c   | 11 -----------
>  src/libsystemd/test-resolve.c |  2 +-
>  4 files changed, 1 insertion(+), 15 deletions(-)
>
> diff --git a/TODO b/TODO
> index a567669..91a7bda 100644
> --- a/TODO
> +++ b/TODO
> @@ -35,7 +35,6 @@ Features:
>  * sd-resolve:
>    - make sure event loop integration works similar to event loop integration in other libs
>    - maybe drop _free() call, introduce _unref() instead
> -  - sd_resolve_freeanswer() is probably pointless, we don't define such a function for any other return values, but expect people to call free directly
>    - maybe simplify function calls that take a sd_resolve_query object, to not also require the matching sd_resolve?
>    - maybe drop the "n_proc" parameter to sd_resolve_new()?
>    - change all functions to return "int" and negative errno errors
> diff --git a/src/libsystemd/resolve-util.h b/src/libsystemd/resolve-util.h
> index 4310f88..58df738 100644
> --- a/src/libsystemd/resolve-util.h
> +++ b/src/libsystemd/resolve-util.h
> @@ -24,8 +24,6 @@
>  #include "util.h"
>
>  DEFINE_TRIVIAL_CLEANUP_FUNC(sd_resolve*, sd_resolve_free);
> -DEFINE_TRIVIAL_CLEANUP_FUNC(unsigned char *, sd_resolve_freeanswer);
>  DEFINE_TRIVIAL_CLEANUP_FUNC(struct addrinfo*, sd_resolve_freeaddrinfo);
>  #define _cleanup_resolve_free_ _cleanup_(sd_resolve_freep)
> -#define _cleanup_resolve_answer_free_ _cleanup_(sd_resolve_freeanswerp)
>  #define _cleanup_resolve_addrinfo_free_ _cleanup_(sd_resolve_freeaddrinfop)
> diff --git a/src/libsystemd/sd-resolve.c b/src/libsystemd/sd-resolve.c
> index a368c1b..6958aa9 100644
> --- a/src/libsystemd/sd-resolve.c
> +++ b/src/libsystemd/sd-resolve.c
> @@ -1105,17 +1105,6 @@ void sd_resolve_freeaddrinfo(struct addrinfo *ai) {
>          errno = saved_errno;
>  }
>
> -void sd_resolve_freeanswer(unsigned char *answer) {
> -        int saved_errno = errno;
> -
> -        if (!answer)
> -                return;
> -
> -        free(answer);
> -
> -        errno = saved_errno;
> -}
> -
>  int sd_resolve_isdone(sd_resolve *resolve, sd_resolve_query*q) {
>          assert(resolve);
>          assert(q);
> diff --git a/src/libsystemd/test-resolve.c b/src/libsystemd/test-resolve.c
> index 7c1e7aa..3903e64 100644
> --- a/src/libsystemd/test-resolve.c
> +++ b/src/libsystemd/test-resolve.c
> @@ -39,7 +39,7 @@ int main(int argc, char *argv[]) {
>          int r = 1, ret;
>          _cleanup_resolve_free_ sd_resolve *resolve = NULL;
>          _cleanup_resolve_addrinfo_free_ struct addrinfo *ai = NULL;
> -        _cleanup_resolve_answer_free_ unsigned char *srv = NULL;
> +        _cleanup_free_ unsigned char *srv = NULL;
>          sd_resolve_query *q1, *q2, *q3;
>          struct addrinfo hints = {};
>          struct sockaddr_in sa = {};
> --
> 1.8.5.3
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel


More information about the systemd-devel mailing list