9162 libpp: this statement may fall through
[unleashed.git] / usr / src / lib / libtnf / record.c
blobb5fabb02877f327b30178e1db0330c8f8d996f8a
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright (c) 1994, by Sun Microsytems, Inc.
26 #pragma ident "%Z%%M% %I% %E% SMI"
28 #include "libtnf.h"
31 * Check a record datum
34 void
35 _tnf_check_record(tnf_datum_t datum)
37 CHECK_DATUM(datum);
39 /* All records must be tagged */
40 if (!INFO_TAGGED(DATUM_INFO(datum)))
41 _tnf_error(DATUM_TNF(datum), TNF_ERR_TYPEMISMATCH);
45 * Retrieve the tag arg, encoded in low 16 bits of tag word
48 tnf_datum_t
49 tnf_get_tag_arg(tnf_datum_t datum)
51 TNF *tnf;
52 tnf_ref32_t *arg;
54 CHECK_RECORD(datum);
56 tnf = DATUM_TNF(datum);
58 /* Should not give an error if not found */
59 /* LINTED pointer cast may result in improper alignment */
60 arg = _tnf_get_tag_arg(tnf, DATUM_RECORD(datum));
62 if (arg == TNF_NULL)
63 return (TNF_DATUM_NULL);
64 else /* repackage the tag arg with its taginfo */
65 return (RECORD_DATUM(tnf, arg));