static int qemu_chr_open_udp(QemuOpts *opts, CharDriverState **_chr)

{

    CharDriverState *chr = NULL;

    NetCharDriver *s = NULL;

    int fd = -1;

    int ret;



    chr = g_malloc0(sizeof(CharDriverState));

    s = g_malloc0(sizeof(NetCharDriver));



    fd = inet_dgram_opts(opts);

    if (fd < 0) {

        fprintf(stderr, "inet_dgram_opts failed\n");

        ret = -errno;

        goto return_err;

    }



    s->fd = fd;

    s->bufcnt = 0;

    s->bufptr = 0;

    chr->opaque = s;

    chr->chr_write = udp_chr_write;

    chr->chr_update_read_handler = udp_chr_update_read_handler;

    chr->chr_close = udp_chr_close;



    *_chr = chr;

    return 0;



return_err:

    g_free(chr);

    g_free(s);

    if (fd >= 0) {

        closesocket(fd);

    }

    return ret;

}

static int qemu_chr_open_udp(QemuOpts *opts, CharDriverState **_chr)

{

    CharDriverState *chr = NULL;

    NetCharDriver *s = NULL;

    int fd = -1;

    int ret;



    chr = g_malloc0(sizeof(CharDriverState));

    s = g_malloc0(sizeof(NetCharDriver));



    fd = inet_dgram_opts(opts);

    if (fd < 0) {

        fprintf(stderr, "inet_dgram_opts failed\n");

        ret = -errno;

        goto return_err;

    }



    s->fd = fd;

    s->bufcnt = 0;

    s->bufptr = 0;

    chr->opaque = s;

    chr->chr_write = udp_chr_write;

    chr->chr_update_read_handler = udp_chr_update_read_handler;

    chr->chr_close = udp_chr_close;



    *_chr = chr;

    return 0;



return_err:

    g_free(chr);

    g_free(s);

    if (fd >= 0) {

        closesocket(fd);

    }

    return ret;

}

    *_chr = chr;     return 0;     *_chr = chr;     return 0;     *_chr = chr;     return 0;     return 0;     return 0;     return 0;     *_chr = chr;     return 0;     *_chr = chr;     return 0;     *_chr = chr;     return 0;     if (fd < 0) {     *_chr = chr;     return 0;     if (fd < 0) {     *_chr = chr;     return 0;     *_chr = chr;     return 0;     *_chr = chr;     return 0;     return 0;     *_chr = chr;     return 0; static int qemu_chr_open_udp(QemuOpts *opts, CharDriverState **_chr)     int ret;         ret = -errno;     *_chr = chr;     return 0;     return ret;     int ret;     if (fd < 0) {         ret = -errno;     *_chr = chr;     return 0;     return ret;     int ret;     *_chr = chr;     return 0;
static int FUNC_0(QemuOpts *VAR_0, CharDriverState **VAR_1)

{

    CharDriverState *chr = NULL;

    NetCharDriver *s = NULL;

    int VAR_2 = -1;

    int VAR_3;



    chr = g_malloc0(sizeof(CharDriverState));

    s = g_malloc0(sizeof(NetCharDriver));



    VAR_2 = inet_dgram_opts(VAR_0);

    if (VAR_2 < 0) {

        fprintf(stderr, "inet_dgram_opts failed\n");

        VAR_3 = -errno;

        goto return_err;

    }



    s->VAR_2 = VAR_2;

    s->bufcnt = 0;

    s->bufptr = 0;

    chr->opaque = s;

    chr->chr_write = udp_chr_write;

    chr->chr_update_read_handler = udp_chr_update_read_handler;

    chr->chr_close = udp_chr_close;



    *VAR_1 = chr;

    return 0;



return_err:

    g_free(chr);

    g_free(s);

    if (VAR_2 >= 0) {

        closesocket(VAR_2);

    }

    return VAR_3;

}

static int FUNC_0(QemuOpts *VAR_0, CharDriverState **VAR_1)
{ CharDriverState *chr = NULL; NetCharDriver *s = NULL; int VAR_2 = -1; int VAR_3; chr = g_malloc0(sizeof(CharDriverState)); s = g_malloc0(sizeof(NetCharDriver)); VAR_2 = inet_dgram_opts(VAR_0); if (VAR_2 < 0) { fprintf(stderr, "inet_dgram_opts failed\n"); VAR_3 = -errno; goto return_err; } s->VAR_2 = VAR_2; s->bufcnt = 0; s->bufptr = 0; chr->opaque = s; chr->chr_write = udp_chr_write; chr->chr_update_read_handler = udp_chr_update_read_handler; chr->chr_close = udp_chr_close; *VAR_1 = chr; return 0; return_err:
g_free(chr); g_free(s); if (VAR_2 >= 0) { closesocket(VAR_2); } return VAR_3; }