int jack_init(struct device *dv, const char *name) { struct jack *jack; /* If this is the first JACK deck, initialise the global JACK services */ if (client == NULL) { if (start_jack_client() == -1) return -1; } jack = malloc(sizeof(struct jack)); if (jack == NULL) { perror("malloc"); return -1; } jack->started = false; if (register_ports(jack, name) == -1) goto fail; dv->local = jack; dv->ops = &jack_ops; assert(ndeck < sizeof device); device[ndeck] = dv; ndeck++; return 0; fail: free(jack); return -1; }
int jack_init(struct device_t *dv, const char *name) { struct jack_t *jack; /* If this is the first JACK deck, initialise the global JACK services */ if (client == NULL) { if (start_jack_client() == -1) return -1; } jack = malloc(sizeof(struct jack_t)); if (!jack) { perror("malloc"); return -1; } jack->started = 0; if (register_ports(jack, name) == -1) goto fail; dv->local = jack; dv->type = &jack_type; assert(decks < MAX_DECKS); device[decks] = dv; decks++; return 0; fail: free(jack); return -1; }