Beispiel #1
0
struct deck *create_deck() {

	struct deck *d = NULL;
	d = calloc(sizeof(struct deck));

	uint8_t idx = 0;
	for (uint8_t s = 1; s < 5; s++) {
		for (uint8_t r = 1; r < 14; r++) {
			d->cards[idx] = create_card(s, r);
			d->count++;
			idx++;
		}
	}

	return d;
}
Beispiel #2
0
static int __devinit snd_probe(struct usb_interface *intf, 
		     const struct usb_device_id *id)
{
	int ret;
	struct snd_card *card;
	struct usb_device *device = interface_to_usbdev(intf);
	
	card = create_card(device);
	
	if (!card)
		return -ENOMEM;
			
	dev_set_drvdata(&intf->dev, card);
	ret = init_card(caiaqdev(card));
	if (ret < 0) {
		log("unable to init card! (ret=%d)\n", ret);
		snd_card_free(card);
		return ret;
	}
	
	return 0;
}
Beispiel #3
0
static int snd_probe(struct usb_interface *intf,
		     const struct usb_device_id *id)
{
	int ret;
	struct snd_card *card = NULL;
	struct usb_device *device = interface_to_usbdev(intf);

	ret = create_card(device, intf, &card);

	if (ret < 0)
		return ret;

	usb_set_intfdata(intf, card);
	ret = init_card(caiaqdev(card));
	if (ret < 0) {
		log("unable to init card! (ret=%d)\n", ret);
		snd_card_free(card);
		return ret;
	}

	return 0;
}
Beispiel #4
0
void add_card_to_hand(Hand *hand, char *rank, char *suit) {
    Card *card = create_card(rank, suit);
    hand->cards  = realloc(hand->cards, (hand->len + 1) * sizeof(Card *));
    hand->cards[hand->len] = card;
    hand->len++;
}