version 1.11, 2015/11/22 16:42:22 |
version 1.12, 2015/11/23 09:48:25 |
|
|
struct port * |
struct port * |
port_new(char *path, unsigned int mode, int hold) |
port_new(char *path, unsigned int mode, int hold) |
{ |
{ |
struct port *c, **pc; |
struct port *c; |
|
|
c = xmalloc(sizeof(struct port)); |
c = xmalloc(sizeof(struct port)); |
c->path = path; |
c->path = path; |
|
|
c->hold = hold; |
c->hold = hold; |
c->midi = midi_new(&port_midiops, c, mode); |
c->midi = midi_new(&port_midiops, c, mode); |
c->num = midi_portnum++; |
c->num = midi_portnum++; |
for (pc = &port_list; *pc != NULL; pc = &(*pc)->next) |
c->next = port_list; |
; /* nothing */ |
port_list = c; |
c->next = NULL; |
|
*pc = c; |
|
return c; |
return c; |
} |
} |
|
|
|
|
struct port *p; |
struct port *p; |
|
|
for (p = port_list; p != NULL; p = p->next) { |
for (p = port_list; p != NULL; p = p->next) { |
if (num-- == 0) |
if (p->num == num) |
return p; |
return p; |
} |
} |
return NULL; |
return NULL; |