From patchwork Sat Jan 4 17:07:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Roth?= X-Patchwork-Id: 3433881 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4EC5AC02DC for ; Sat, 4 Jan 2014 17:09:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7B4862015D for ; Sat, 4 Jan 2014 17:09:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9C55720158 for ; Sat, 4 Jan 2014 17:09:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754770AbaADRJN (ORCPT ); Sat, 4 Jan 2014 12:09:13 -0500 Received: from mail-ee0-f49.google.com ([74.125.83.49]:56360 "EHLO mail-ee0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754691AbaADRIr (ORCPT ); Sat, 4 Jan 2014 12:08:47 -0500 Received: by mail-ee0-f49.google.com with SMTP id c41so7182441eek.36 for ; Sat, 04 Jan 2014 09:08:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=SzIKGVykYUM0M4C0EMnkX6Oj6fbBzWvhKdYeMczWxmQ=; b=P44gORCNu6gU7BPC6KgDw5bB9JUWeNxlnWL+FhgOJ2rQ56sEJVrss/ekQOpxn3kfsK dmYrfdO17y9bh3nORYoUa1By5McfPgmivH7CjW4RN+Vc5QOuFH9KbpxkmIv3gU2vypIJ IK7ztxlfPUQOraREbI+26LBc5yTy7xhvBbewmvosn7HyqUMfqA5oW4ulQxj/D+CCn1k3 Zg7yUG0872uhc8yfrzffFKcT9T33O0f1yx/aIRyo4godXE6fl9I92bKnbBZBhPa0Gajm GdOQrURZUKY8+an0aqumVRhhJcrrVGIlHrKvHOlusm58k/eztkDYb2ArgmBN2zdB0+1W MmXg== X-Received: by 10.15.56.7 with SMTP id x7mr26694820eew.43.1388855325892; Sat, 04 Jan 2014 09:08:45 -0800 (PST) Received: from exciton.exnihilo. (140-227.61-188.cust.bluewin.ch. [188.61.227.140]) by mx.google.com with ESMTPSA id e3sm155011641eeg.11.2014.01.04.09.08.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 04 Jan 2014 09:08:45 -0800 (PST) From: =?UTF-8?q?Andr=C3=A9=20Roth?= To: linux-media@vger.kernel.org Cc: =?UTF-8?q?Andr=C3=A9=20Roth?= Subject: [PATCH 09/11] libdvbv5: use TABLE_INIT macro Date: Sat, 4 Jan 2014 18:07:59 +0100 Message-Id: <1388855282-19295-9-git-send-email-neolynx@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1388855282-19295-1-git-send-email-neolynx@gmail.com> References: <1388855282-19295-1-git-send-email-neolynx@gmail.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: André Roth --- lib/include/libdvbv5/descriptors.h | 2 +- lib/libdvbv5/descriptors.c | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/lib/include/libdvbv5/descriptors.h b/lib/include/libdvbv5/descriptors.h index d5feb4f..bc80940 100644 --- a/lib/include/libdvbv5/descriptors.h +++ b/lib/include/libdvbv5/descriptors.h @@ -35,7 +35,7 @@ struct dvb_v5_fe_parms; -typedef void (*dvb_table_init_func)(struct dvb_v5_fe_parms *parms, const uint8_t *buf, ssize_t buflen, uint8_t *table, ssize_t *table_length); +typedef void (*dvb_table_init_func)(struct dvb_v5_fe_parms *parms, const uint8_t *buf, ssize_t buflen, void *table, ssize_t *table_length); struct dvb_table_init { dvb_table_init_func init; diff --git a/lib/libdvbv5/descriptors.c b/lib/libdvbv5/descriptors.c index 48f3fe7..c7d535c 100644 --- a/lib/libdvbv5/descriptors.c +++ b/lib/libdvbv5/descriptors.c @@ -78,18 +78,20 @@ static void dvb_desc_default_print(struct dvb_v5_fe_parms *parms, const struct d hexdump(parms, "| ", desc->data, desc->length); } +#define TABLE_INIT( _x ) { (dvb_table_init_func) _x##_init, sizeof(struct _x) } + const struct dvb_table_init dvb_table_initializers[] = { - [DVB_TABLE_PAT] = { dvb_table_pat_init, sizeof(struct dvb_table_pat) }, - [DVB_TABLE_CAT] = { dvb_table_cat_init, sizeof(struct dvb_table_cat) }, - [DVB_TABLE_PMT] = { dvb_table_pmt_init, sizeof(struct dvb_table_pmt) }, - [DVB_TABLE_NIT] = { dvb_table_nit_init, sizeof(struct dvb_table_nit) }, - [DVB_TABLE_SDT] = { dvb_table_sdt_init, sizeof(struct dvb_table_sdt) }, - [DVB_TABLE_EIT] = { dvb_table_eit_init, sizeof(struct dvb_table_eit) }, - [DVB_TABLE_EIT_SCHEDULE] = { dvb_table_eit_init, sizeof(struct dvb_table_eit) }, - [ATSC_TABLE_MGT] = { atsc_table_mgt_init, sizeof(struct atsc_table_mgt) }, - [ATSC_TABLE_EIT] = { atsc_table_eit_init, sizeof(struct atsc_table_eit) }, - [ATSC_TABLE_TVCT] = { atsc_table_vct_init, sizeof(struct atsc_table_vct) }, - [ATSC_TABLE_CVCT] = { atsc_table_vct_init, sizeof(struct atsc_table_vct) }, + [DVB_TABLE_PAT] = TABLE_INIT(dvb_table_pat), + [DVB_TABLE_CAT] = TABLE_INIT(dvb_table_cat), + [DVB_TABLE_PMT] = TABLE_INIT(dvb_table_pmt), + [DVB_TABLE_NIT] = TABLE_INIT(dvb_table_nit), + [DVB_TABLE_SDT] = TABLE_INIT(dvb_table_sdt), + [DVB_TABLE_EIT] = TABLE_INIT(dvb_table_eit), + [DVB_TABLE_EIT_SCHEDULE] = TABLE_INIT(dvb_table_eit), + [ATSC_TABLE_MGT] = TABLE_INIT(atsc_table_mgt), + [ATSC_TABLE_EIT] = TABLE_INIT(atsc_table_eit), + [ATSC_TABLE_TVCT] = TABLE_INIT(atsc_table_vct), + [ATSC_TABLE_CVCT] = TABLE_INIT(atsc_table_vct), }; char *default_charset = "iso-8859-1";