Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'core/lib' into next

* core/lib:
  follow-up, deal with pointerised ud_chan_init()
  minor, deal with pointers in ud_chan_{init,fini}(), struct is too big for stack
  • Loading branch information...
commit 3ff7216e1f67a003db901892c4767aca67fd84a7 2 parents bcda795 + a0d90a6
@hroptatyr authored
Showing with 14 additions and 12 deletions.
  1. +2 −2 cli/ud-xmit.c
  2. +10 −8 src/libstuff.c
  3. +2 −2 src/unserding.h
View
4 cli/ud-xmit.c
@@ -219,9 +219,9 @@ work(const struct xmit_s *ctx)
int
main(int argc, char *argv[])
{
- static struct ud_chan_s hdl;
struct gengetopt_args_info argi[1];
struct xmit_s ctx[1];
+ ud_chan_t hdl;
int res = 0;
/* parse the command line */
@@ -247,7 +247,7 @@ main(int argc, char *argv[])
/* the actual work */
switch (setjmp(jb)) {
case 0:
- ctx->ud = &hdl;
+ ctx->ud = hdl;
ctx->speed = argi->speed_arg;
ctx->restampp = argi->restamp_given;
work(ctx);
View
18 src/libstuff.c
@@ -401,23 +401,25 @@ free_unserding_handle(ud_handle_t hdl)
}
/* lower level connection */
-struct ud_chan_s
+ud_chan_t
ud_chan_init(short unsigned int port)
{
- struct ud_chan_s res;
+ struct ud_chan_s *res;
- (void)mcast6_init(&res);
- setsock_nonblock(res.sock);
- ud_chan_set_port(&res, port);
+ res = malloc(sizeof(*res));
+ (void)mcast6_init(res);
+ setsock_nonblock(res->sock);
+ ud_chan_set_port(res, port);
return res;
}
void
-ud_chan_fini(struct ud_chan_s c)
+ud_chan_fini(ud_chan_t c)
{
/* and kick the socket */
- shutdown(c.sock, SHUT_RDWR);
- close(c.sock);
+ shutdown(c->sock, SHUT_RDWR);
+ close(c->sock);
+ free((struct ud_chan_s*)c);
return;
}
View
4 src/unserding.h
@@ -174,10 +174,10 @@ ud_handle_sock(ud_handle_t hdl)
/* lower level connexion stuff */
/**
* Get a socket to communicate with service PORT. */
-extern struct ud_chan_s ud_chan_init(short unsigned int port);
+extern ud_chan_t ud_chan_init(short unsigned int port);
/**
* Free resources associated with a connection. */
-extern void ud_chan_fini(struct ud_chan_s);
+extern void ud_chan_fini(ud_chan_t);
/* specific services */
Please sign in to comment.
Something went wrong with that request. Please try again.